W
W
wagwandude2017-01-28 23:38:15
Laravel
wagwandude, 2017-01-28 23:38:15

How to properly implement user groups?

Hello.
Started to implement user groups on the site:
1. Added/edited groups and rights (stored in JSON format)
2. Changed the user's group.
3. Upon authorization, the current group and its capabilities are added to the session.
Now you don't have to make a mistake.
How to approach the implementation of the following:
1. You need to decode the JSON string in the session, but unserialize is not suitable.
2. How to make sure that all routes pass through the rights?
I suppose you need to create your own middleware, then register it in Kernel.php, but then how to accept a session in it?
In general, I will be glad to all advice.
It would be desirable to implement the access rights of users as competently as possible.
Thanks in advance!8435acdd67914e958fb351836c55a666.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2017-01-29
@Nc_Soft

https://laravel.com/docs/5.3/authorization#gates

A
Alex Wells, 2017-02-02
@Alex_Wells

Just use https://github.com/JosephSilber/bouncer
Connects in seconds, has limitless possibilities.. writing your own bike is silly to say the least.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question