Zizaco / entrust

Role-based Permissions for Laravel 5
MIT License
6.05k stars 1.29k forks source link

permissions by subdomain or another indicator #804

Open iateadonut opened 7 years ago

iateadonut commented 7 years ago

We have an app with many subdomains.

A single user could have a role on a single subdomain, or many subdomains.

Is there an easy way to add a 'subdomain_id' column to permissions or roles?

In other words, I've got an app that is organized by companies. $companies can have $posts. I want certain users to have different $roles but only based on the $company, so a $user with a $role at company_1 would not have that role at company_2, but might also have that role in company_3.

PaoloFalomo commented 7 years ago

You'll probably need two things to achive this result:

Make the migrations

In laravel you can edit columns with migrations.

Edit the model

You'll need to edit the model so you can easly attach/retrive subdomain_id value. See Relationship for this.