Please support multiple domain/tenant or filtering
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 19
- Forks
- 8
- Avg merge
- 50m
- Merged PRs (30d)
- 1
Description
I want to design a multiple domain/tenant RBAC .
but auth_assignment item_name is primary key.
So I need create roles domain/1/admin , domain/2/admin etc .... then I can assign user to those domains.
But It's hard for manage, because I need add all permission for each domain roles.
I think rbac-db can add a domain id to auth_assignment table.
But not everyone need domain id , so this is not a good idea.
Another way, If use a filter , maybe it can be more flexible , ex:
$myfilter = new DbRbacFilter (1); //
Yii::$app->user->can("user" , "edit" , myfilter);
interface DbRbacFilterInterface {
public function beforeQueryAssignment($query);
}
class DbRbacFilter implement DbRbacFilterInterface {
protected $domainId;
public function __constructor($domain_id) {
$this->domainId = $domain_id;
}
public function beforeQueryAssignment($query) {
$query->where("domain_id" , $this->domainId);
}
}
Then I can add domain_id column to assignment_table .
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the auth_assignment table and the assignment lookup reached by Yii::$app->user->can(), then compare the proposed DbRbacFilterInterface with the alternative of adding an optional domain_id column. The work is complete when a design is agreed for filtering assignments by domain while preserving behavior for installations that do not use domains.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- authorization, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100