chore(deps): Update project dependencies and refactor authentication flow

- Upgrade Next.js to version 15.1.7
- Update Drizzle ORM and related dependencies
- Add Nodemailer and related type definitions
- Refactor authentication routes and components
- Modify user schema to include first and last name
- Update authentication configuration and session handling
- Remove deprecated login and register pages
- Restructure authentication-related components and routes
This commit is contained in:
2025-02-11 23:55:27 -05:00
parent e6962aef79
commit 6e3f2e1601
65 changed files with 6171 additions and 1273 deletions

View File

@@ -14,18 +14,124 @@ An *action* is a specific operation that is being done (like "move to position",
A *participant* is a person that has been added to a study. This person does not have an account.
A *user* is a person that has an account, which is a person that has been added to a study. Anyone can sign up for an account, but they must be added to a study or create their own. A user can have one of many roles, but can only have one role at a time. They can be in one or more studies, allowing them to have different roles in different studies.
A *user* is a person that has an account, which is a person that has been added to a study. Anyone can sign up for an account, but they must be added to a study or create their own. A user can have different roles in different studies.
A *role* is a set of permissions that a user has in a study. A user can have one or more roles, but can only have one role at a time per study.
## Roles and Permissions
A *permission* is a specific action that a user can perform in a study. Permissions are grouped into categories, and each category has a set of permissions.
### Core Roles
Roles and permissions:
1. **Owner**
- Single owner per study
- Full control over all aspects of the study
- Can delete study or transfer ownership
- Can manage all other roles
- Usually the study creator or designated successor
- Cannot be removed except through ownership transfer
An admin is a user with all permissions in a study. This is usually the creator of the study, but may not be the principal investigator.
The principal investigator is the PI of the project- may not be the creator of the study on the platform
A wizard is a user that can run experiment trials, and can view the results of the trials.
A researcher is a user that can view the results of the trials, and interpret the data.
2. **Admin**
- Multiple admins allowed
- Can manage participants, experiments, and study settings
- Can invite and manage other users (except Owner)
- Cannot delete study or transfer ownership
- Appointed by Owner
3. **Principal Investigator (PI)**
- Scientific oversight role
- Full access to participant data and experiment design
- Can manage experiment protocols
- Can analyze and export all data
- Cannot modify core study settings or manage user roles
- Typically one PI per study
4. **Wizard**
- Operates the robot during experiment trials
- Can control live experiment sessions
- Can view anonymized participant data
- Can annotate experiments in real-time
- Cannot modify study design or access sensitive participant data
- Multiple wizards allowed
5. **Researcher**
- Can view and analyze experiment data
- Can access anonymized participant information
- Can export and analyze results
- Cannot modify study design or participant data
- Cannot run experiment trials
- Multiple researchers allowed
6. **Observer**
- Can view live experiments
- Can view anonymized participant data
- Can add annotations
- Cannot modify any study aspects
- Cannot access sensitive data
- Multiple observers allowed
### Permission Categories
1. **Study Management**
- Create/Delete Study (Owner only)
- Edit Study Settings
- Transfer Ownership (Owner only)
- Manage Study Metadata
2. **Participant Management**
- Add/Remove Participants
- View Participant Details (identifiable vs. anonymized)
- Edit Participant Information
- Manage Participant Consent Forms
3. **Experiment Design**
- Create/Edit Experiment Templates
- Define Steps and Actions
- Set Robot Behaviors
- Configure Data Collection
4. **Experiment Execution**
- Run Experiment Trials
- Control Robot Actions
- Monitor Live Sessions
- Add Real-time Annotations
5. **Data Access**
- View Raw Data
- View Anonymized Data
- Export Data
- Access Participant Identifiable Information
6. **User Management**
- Invite Users
- Assign Roles
- Remove Users
- Manage Permissions
### Role-Permission Matrix
| Permission Category | Owner | Admin | PI | Wizard | Researcher | Observer |
|-----------------------|-------|-------|-----|--------|------------|----------|
| Study Management | Full | Most | No | No | No | No |
| Participant Management| Full | Full | Full| Limited| Limited | View Only|
| Experiment Design | Full | Full | Full| No | No | No |
| Experiment Execution | Full | Full | Full| Full | View Only | View Only|
| Data Access | Full | Full | Full| Limited| Limited | Limited |
| User Management | Full | Most | No | No | No | No |
### Special Considerations
1. **Data Privacy**
- Identifiable participant information is only accessible to Owner, Admin, and PI roles
- All other roles see anonymized data
- Audit logs track all data access
2. **Role Hierarchy**
- Owner > Admin > PI > Wizard/Researcher > Observer
- Higher roles inherit permissions from lower roles
- Certain permissions (like study deletion) are restricted to specific roles
3. **Role Assignment**
- Users can have different roles in different studies
- One user cannot hold multiple roles in the same study
- Role changes are logged and require appropriate permissions
Participant Management: can create, update, delete participants, as well as view their personal information
- Admin: can do everything