On current condition, user's data can only be modified by their managers (the one whom user ID stored on users.manager_id column). So we want to create a feature which allow us to set some users to be an admin.
Here is a possible solution without changing any DB structure:
We have a env var and config to store array of user emails
We take the user emails on the config to determine the system's admin.
Config key: config('app.system_admins');
Config value data type: array (of email addresses).
For example:
We have User A, user B and User C
User A is manager of User B, but not User C
User A can edit User B data, but cannot edit user C data.
We add user A email address on the app.system_admins config
User A now can edit all user's data the system (not only User B).
This feature resolves this problem:
Any user can be assigned as system admin to edit any user's data.
On current condition, user's data can only be modified by their managers (the one whom user ID stored on
users.manager_id
column). So we want to create a feature which allow us to set some users to be an admin.Here is a possible solution without changing any DB structure:
config('app.system_admins');
array
(of email addresses).For example:
app.system_admins
configThis feature resolves this problem: Any user can be assigned as system admin to edit any user's data.