Open ywarnier opened 2 months ago
Added in this PR https://github.com/chamilo/chamilo-lms/pull/5651 , waiting for testing to merge , the interface for permissions management is /permissions
Well done!
@christianbeeznest We need to add one permission "Edit course settings" so that teachers can be given limited access to a course, if needed. This permission is on by default for all teachers, but can be removed (also for all teachers) at once.
It is done with this commit https://github.com/chamilo/chamilo-lms/pull/5723/commits/70b8eef2bd90d3ad518da5a2367c994d615b9f39
Add the possibility to define fine-grained permissions and assign them to roles.
A definition of basic permissions is ongoing here: https://github.com/chamilo/chamilo-lms/wiki/Permissions
Create a Permission entity with id, title, slug and description. Create a PermissionRelRole entity with id, permission_id, role_code, changeable, updated_at. Create an assignment interface with roles in columns and permissions in rows, like so:
allowing one to check the boxes for each role (except when changeable == 0). This is then sent to the PermissionRelRole entity/table.
Use the wiki table as source for the default definition of each set of permissions per role.
Define a global permission function to search for the existence of a permission based on the permission name and an array of roles. Something like
api_get_permission('analytics:view', ['ROLE_STUDENT','ROLE_TEACHER'])
. This function/helper will then check, for the given permission, if one or more of the roles provided has the permission enabled and return true or false based on that.Relates to #2540