database - How to assign user+group-specific roles in Laravel 4 with Entrust -


background: 1 user can in zero, one, or many departments.

i trying setup roles , permissions in application using entrust package zizaco. seems straightforward, use-case different offers out-of-the-box, if understanding correctly, supposed attach role user.

in case, user can have different role in different department. example, user john in department administrator, while john in department b reviewer. if use entrust as-is john have both administrator , reviewer in both departments belongs to.

i have tried creating pivot table between user , department , modifying entrust work off 'id' in department_user table, cannot work correctly when try simple following create table show user in department has role:

$department = department::find(1); $users = $department->users; 

is there way can modify entrust work this? or there better package type of use-case? roles same across departments , sake of efficiency avoid creating department-specific roles (like accounting administrator, biology administrator, etc.)


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -