Overview
Wecode provides a comprehensive user management system with role-based access control, bulk user creation, and trial account management.User Roles
Wecode supports five distinct user roles with different permission levels:Admin
Full system access, can manage all users, assignments, and problems
Head Instructor
Can create assignments, manage classes, and create instructor/student accounts
Instructor
Can create assignments and student accounts within their classes
Student
Can submit solutions and view personal submissions
Guest
Limited access, cannot make submissions
User Model
The User model includes the following key fields:User.php:27-29
Relationships
User.php:55-74
Creating Users
Single User Creation
Admins can create individual users through the web interface. Route:POST /users
UserController.php:178-193
Bulk User Creation
Create multiple users at once using CSV format. Route:GET /users/add_multiple
- CSV Format
- Implementation
Use
random[N] in the password field to generate a random password of N characters.User Permissions
Permission Hierarchy
UserController.php:383-406
Trial Accounts
Manage temporary student access with automatic expiration.Setting Trial Time
Route:POST /users/set_trial
- By Duration
- By End Date
UserController.php:495-497
Automatic Expiration
Trial accounts automatically convert to guest accounts when expired:Assignment.php:106-113
User Management Routes
All User Routes
All User Routes
| Method | Route | Action | Permission |
|---|---|---|---|
| GET | /users | List all users | admin, head_instructor |
| GET | /users/create | Show create form | admin |
| POST | /users | Create user | admin |
| GET | /users/{id} | Show user profile | admin, head_instructor, instructor, self |
| GET | /users/{id}/edit | Show edit form | admin, self |
| PUT | /users/{id} | Update user | admin, self |
| DELETE | /users/{id} | Delete user | admin |
| GET | /users/add_multiple | Bulk add form | admin, head_instructor, instructor |
| POST | /users/adds | Process bulk add | admin, head_instructor, instructor |
| POST | /users/set_trial | Set trial time | admin, head_instructor, instructor |
| GET | /users/ranking | User rankings | authenticated |
| POST | /users/delete_submissions/{user} | Delete user submissions | admin |
User Statistics
View detailed user statistics and submission history:UserController.php:55-121
Best Practices
Security
- Always hash passwords with
Hash::make() - Validate email uniqueness
- Enforce minimum password length (8 characters)
- Use role-based access control
Trial Accounts
- Set appropriate trial duration
- Monitor trial expiration
- Communicate expiration to users
- Have upgrade process ready
Bulk Creation
- Use CSV format for consistency
- Generate random passwords for security
- Validate all user data before creation
- Review error reports after bulk import
User Management
- Regular cleanup of guest accounts
- Monitor user submission activity
- Maintain class enrollment
- Backup user data regularly

