1
votes

I'm trying to create a shopping system that admin user can get access to everyone to do anything he want.

Same rbac any users have some access and some one has more but in this case admin take access to others without dependencies to rules. My means that may admin let to a special writer an access from publisher.

In this system rules are not important. Just admin and everyone how has this access can decide how do what!

In other words i want give access user directly to actions or not without any rule define.

How should create this in yii2?

1
You can use the rbac provide by yii2ScaisEdge
Please check this out [yiiframework.com/doc-2.0/guide-security-authorization.html] Hope it will help you..Ravindra Bhalothia
Rbac has a problem. In my system there isn't any rule. Just permissions are important. @scaisEdgeAmin
I don't use any rules only permission .. and work like you needScaisEdge
@scaisEdge You just assigned permissions to users without defining rules? It's work? Can you explain plz?Amin

1 Answers

1
votes

In permission i define all the items of type permission for the low level permission and the items of type role for the items for grouping

Then in items child i define all the yierachical bound between permssion of type permission child and parent

once these are done

in assigment the user is assigned to permission (parant of type role, normally) related to the behavoir i want assign to this user ..

and finally i check the rbac by the function Yii::$app->User->can('myPermissionForTheUser')

eg:

if ( Yii::$app->User->can('admin') ){


 }