DirectoryTree / LdapRecord-Laravel

Multi-domain LDAP Authentication & Management for Laravel.
https://ldaprecord.com/docs/laravel/v3
MIT License
481 stars 50 forks source link

How can I work with roles? #150

Closed kruiz122893 closed 4 years ago

kruiz122893 commented 4 years ago

Hi @stevebauman how are you?

Currently i am working on applications where anyone fill a form and then a administrator need to press btn for approbal request and create record and active directory

I wish i know if exist something to hide buttons if you aren't administrator for example

kruiz122893 commented 4 years ago

For example spatie\laravel works good but need roles and in this case i dont have

i tested with rules https://ldaprecord.com/docs/laravel/auth/configuration/#rules but doesnt work good for my needed

stevebauman commented 4 years ago

Hi @kruiz122893, I'm doing great, thanks! How are you?

For example spatie\laravel works good but need roles and in this case i don't have

Since you're using multiple guards that connect to separate domains, I would avoid using Spatie Laravel Permission due to this incompatibility:

https://github.com/DirectoryTree/LdapRecord-Laravel/issues/101 & https://github.com/spatie/laravel-permission/issues/1425 & https://github.com/spatie/laravel-permission/issues/1203

I would instead use JosephSilber's bouncer instead, as it allows you to choose a user model and doesn't use guards in creating permissions:

https://github.com/JosephSilber/bouncer#user-model

This will be much less of a headache for you in permission and role management.

If you want something even easier to integrate, I have also created a package for this:

https://github.com/directorytree/authorization

It has less features than Bouncer, but doesn't require you to learn any new API. It simply uses standard Laravel relationships.

Whichever you choose is totally up to you and your app :smile:

stevebauman commented 4 years ago

I've been thinking about transitioning my authorization package into something that integrates with LdapRecord, but I'm unsure if there's a large demand for it.

Are you looking at synchronizing LDAP groups into your database, or are you creating your own Laravel application groups / roles and applying them to imported LDAP users?

kruiz122893 commented 4 years ago

Hi @stevebauman thanks for the advice, really sounds good i will to check right now

I think to create my own groups but i don't know yet

kruiz122893 commented 4 years ago

Hi @stevebauman

I wish i will following the topic on : https://github.com/larapacks/authorization/issues/20