Scope/Group/Role/Permissions database architecture -
i'm building internal web app , struggling db design theory.
i've got roles & permissions set laravel & entrust, i'm trying add functionality of scopes , groups , i'm not quite sure how achieve it.
given following scopes:
- company
- team
and these roles:
- admin
- editor
- author
and these groups(teams):
- sales
- development
- design
i've added scopes functionality works great, can have permission assigned admin in company scope, want able assign permissions admins in team scope according team belong to.
the application quite expansive, keep simple here i'll focus on couple of use cases need satisfy: team , employee profiles.
team profiles
- all employees can view team profiles
- a company admin can edit team profiles
- a team admin can edit own team profile
employee profiles
- all employees can view employee profiles
- a company admin can edit employee profiles
- a team admin can edit employee profiles within own team
- an employee can edit own profile
what's best way achieve this? every time try , approach solution feels overly complex , bury myself in nested foreach loops. bed i've made myself or there better way check permission against role, scope & group @ same time?
Comments
Post a Comment