Spatie Permission #566
Replies: 4 comments
-
I would love to get some insights in how to do this |
Beta Was this translation helpful? Give feedback.
-
Hi @RobertoLanzeni, By "role" are you referring to "group"? LDAP directories do not contain a representation for roles. If so, you can utilize the https://ldaprecord.com/docs/laravel/v3/auth/restricting-login#checking-for-a-single-group use LdapRecord\Models\ActiveDirectory\User;
$user = User::findOrFail('cn=John Doe,ou=dc=local,dc=com');
$isAdmin = $user->groups()->exists('cn=Administrators,ou=Groups,dc=local,dc=com'); |
Beta Was this translation helpful? Give feedback.
-
See also #571 |
Beta Was this translation helpful? Give feedback.
-
Which I have now updated with an answer, @RobertoLanzeni . |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys.
I've extended my app with LdapRecord Package.
First myApp did login with database in local directly from App. Now I've switched to remote login on LDAP server.
I've noticed that i can't retrieve role of single users, because spatie use local DB to get role of each User.
How can I use this package to get which Role() Users have?
Thanks for your reply
Bo
Beta Was this translation helpful? Give feedback.
All reactions