nutzt
nutzt

Reputation: 2923

Laravel multiple user types with groups

I am currently building a website with the following user types:

Each user type should only be allowed to do certain things.

However, the system users are somewhat different. These should be able to be divided into groups, and these groups should also have different rights. My customer should be able to create/edit these groups including the assignment of given rights. However, it should not be possible to edit the other user types.

I have already seen this ACL packages (https://github.com/spatie/laravel-permission and https://github.com/JosephSilber/bouncer). But I don't think they support that.

I have also thought of the following approach: There is no user type "system user", but the users are assigned the type of group, and in the code, I check if this type is "customer","caregiver","partner" and "agent". If this is not the case, the user is automatically a system user.

Is there perhaps an open source project that has such a similar approach? I'm currently having a hard time with all the controller classes at the moment (have now merged them into a single user controller and have the $type in the route and a factory class return the right model to me, and then call up a factory again to return the respective service class <- feels totally wrong and badly implemented).

Upvotes: 1

Views: 791

Answers (1)

Lloople
Lloople

Reputation: 1844

Currently, Joseph Silber is building multi-tenancy for Bouncer. I think that will fit your needs, but it's not released yet for the time I'm writing this.

Also, it's practically 100% sure that you will need to extend a package like that or fork it to adapt to your needs. Looks like a very specific code that will need modifications.

Upvotes: 1

Related Questions