dapmsipd / pips

Public Investment Program System
1 stars 0 forks source link

Allow users to belong to more than one office and/or be more flexible when dealing with office designation #118

Open mlab817 opened 11 months ago

mlab817 commented 11 months ago

Is your feature request related to a problem? Please describe. Currently, the system is designed to support one office per user. However, during this updating, we encountered an issue where the user can have the following situation:

  1. change office between updating periods; and
  2. belong to more than one office.

In addition, the user may also have different roles among offices they belong to.

Describe the solution you'd like The proposed solution is to have another table called user_offices that has a user_id, office_id, and role_id columns. The next step is to give user an "active_office" relationship which is just toggling office_id based on office selection. The role should then adjust based on the selected office. So the relationship would be belongsToMany with pivot column (role_id).

In the frontend app, a dropdown selection will be added to the AppBar. Then, the available offices and corresponding role will be selectable.

In the backend, a new function will be added to User.php called "toggleOffice" which takes in a parameter $office and will update the user office.

Describe alternatives you've considered To force the user to create a different account per office they belong to.

Additional context N/A