E
E
ettychel2019-06-03 16:13:39
Access rights
ettychel, 2019-06-03 16:13:39

Implementation of groups, roles and user rights in laravel, is there such a solution?

Good afternoon!
Please tell me, I googled, I did not find anything like this ready.
It is necessary that the user has a group, then he can follow a specific route.
(The route skips only 1 group, in turn the user can have membership in several groups)
Next, it is necessary that the user has a role by which it will be determined what will be displayed on the page. Even this will be enough.
Sample scheme
User - id, name, password
1, Petya, qwe
2, Vasya, ewq
3, Kolya, qaz
Group - user_id, group_id, group_name (for clarity)
1, 1, Worker
1, 2, Warmir
2, 3, Security
3, 1, worker
Roles - user_id, role_id, group_id, role_name (for clarity)
1, 1, 1, Admin
2, 2, 1, Moder
3, 3, 2, User
2, 1, 3, Admin
And it turns out that the user Petya can switch to Worker and on Warmir , on Worker it will be Admin , and on Warmir it
has no
role -> hasToMany(Role) REQUIRED LIKE THIS: User -> hasToMany(Group) User ->hasToMany(Role) Group -> hasToMany(Role)

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
Stanislav, 2019-06-03
@ettychel

So you need a normal ACL with roles, rights and other things. I usually use this package https://github.com/spatie/laravel-permission

I
Igor Vorotnev, 2019-06-03
@HeadOnFire

Laravel ACL

V
vism, 2019-06-03
@vism

The best bouncer - like so.
Why I don’t remember the best, but I decided for myself a year ago.

V
vladislavs, 2021-01-27
@vladislavs

Here is a nice and simple solution to roles and rights! Helped me
https://laravel.demiart.ru/guide-to-roles-and-perm...

D
Dmitry, 2019-06-14
@dlnsk

Laravel 5. Hierarchical RBAC for the smallest

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question