How to Write a Model to inherit yiibaseModel to implement all RESTful operations. Now my main problem is that I use RESTful and RBAC of Yii2. Now I want users to modify their permissions in the background. For example, permission management PermissionManager column... how to write a Model inheritance
yii\base\ModelTo implement all RESTful operations.
Now my main problem is that I use RESTful and RBAC of Yii2. Now I want users to modify their permissions in the background.
For example, Permission management Permission Manager
The real code that lists all permissions. This is the data source.
$ Auth = Yii: $ app-> getAuthManager ();
$ Permissions = $ auth-> getPermissions ();
Create a permission:
Of course, permissionName is the value input by the recipient.
$ Auth = Yii: $ app-> getAuthManager ();
$ PermissionNode = $ auth-> createPermission ($ permissionName );
$ Auth-> add ($ permissionNode );
In any case, you are welcome to give more suggestions and implementation methods.
Reply content:
How to Write a Model inheritance by yourselfyii\base\ModelTo implement all RESTful operations.
Now my main problem is that I use RESTful and RBAC of Yii2. Now I want users to modify their permissions in the background.
For example, Permission management Permission Manager
The real code that lists all permissions. This is the data source.
$ Auth = Yii: $ app-> getAuthManager ();
$ Permissions = $ auth-> getPermissions ();
Create a permission:
Of course, permissionName is the value input by the recipient.
$ Auth = Yii: $ app-> getAuthManager ();
$ PermissionNode = $ auth-> createPermission ($ permissionName );
$ Auth-> add ($ permissionNode );
In any case, you are welcome to give more suggestions and implementation methods.
Use a custom public interface.