Yii Box: Role Based Access Control

I implement role-based access control using the yii framework for the application mentioned in Agile web application development using the yii framework. I implemented everything up to page number 189.

page number 189 says that the following method can be used to check whether the user is allowed to perform an action or not.

If (Yii :: app () โ†’ user-> checkAccess ('createIssue')) {// execute the necessary logic}

but this method always returns false for users who have been assigned the createIssue operation

Below is the database diagram for RBAC

enter image description here

I bind the UserID and role for the authassignment table using the following command.

$AUTH = Yii:: () โ†’ AuthManager; $Auth- > ( '' , 1);

, authassignment .

main.php

, , , - . .

+5
1

, ! , . :

$auth=Yii::app()->authManager; $auth->assign('member',1)

'member' , '1' - , . "userid" "authassigment" .

+6

All Articles