Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Andron's avatar

LDAP Record and Spatie roles and permissions

Hello there.

We have implemented LDAP record package, v2.x, and our company employees can log in into system using their domain credentials without registration.

But also I need to add Spatie roles and permissions for those users with keeping LDAP login mechanism. Do you know how I can do that?

Many thanks in advance, Andranik

0 likes
8 replies
Andron's avatar

@Sinnbeck thanks a lot, Yes as soon as user first time successfully logged into system with LDAP, user's data saved into database. So, all what I need now just implement Spatie roles and permissions?

Sinnbeck's avatar

@Andron Exactly. I have a script that every night syncs new users and assigns them our "default" role :) New users are always added a few days before they start.

2 likes
Andron's avatar

@Sinnbeck, and for login can I use Laravel Breeze? Before that I used Laravel ui package.

KodaC's avatar

@sinnbeck Is there any way to show the script?

I have several security groups. I want to check once a day which users in my database are in group X and give them a spatie permission.

ACH's avatar

Anyone who has mapped AD/LDAP groups with spatie/laravel-permission roles? If so, how?

maxieayala's avatar

@ACH how do you obtain the role id, i try in my view also I tried to use the middleware of permission but always obtain null

Please or to participate in this conversation.