refactor: update role permissions and enhance RBAC logic to include own permissions for courses and dashboard access

This commit is contained in:
swve 2025-08-06 14:12:43 +02:00
parent a1976c5423
commit 9f13884c08
8 changed files with 201 additions and 31 deletions

View file

@ -16,14 +16,36 @@ class Permission(BaseModel):
return getattr(self, item)
class PermissionsWithOwn(BaseModel):
action_create: bool
action_read: bool
action_read_own: bool
action_update: bool
action_update_own: bool
action_delete: bool
action_delete_own: bool
def __getitem__(self, item):
return getattr(self, item)
class DashboardPermission(BaseModel):
action_access: bool
def __getitem__(self, item):
return getattr(self, item)
class Rights(BaseModel):
courses: Permission
courses: PermissionsWithOwn
users: Permission
usergroups : Permission
collections: Permission
organizations: Permission
coursechapters: Permission
activities: Permission
roles: Permission
dashboard: DashboardPermission
def __getitem__(self, item):
return getattr(self, item)