Skip to content

Mapping LDAP groups to Spatie Permissions roles #571

Answered by acharseth
acharseth asked this question in Q&A
Discussion options

You must be logged in to vote

Groups can be mapped to roles by creating a handler for that. I called it RoleHandler and added it to config/auth.php:

'providers' => [
        'users' => [
            'driver' => 'ldap',
            'model' => \App\Ldap\User::class,
            
            'database' => [
                'model' => App\Models\User::class,
                'sync_passwords' => false,
                'sync_attributes' => [
                    'name' => 'cn',
                    'email' => 'mail',
                    'userid' => 'samaccountname',
                    \App\Ldap\RoleHandler::class,
                ],
                'sync_existing' => [
                    'email' => 'mail',
                ],…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by acharseth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant