Hello, everyone.
I am now using the YII Framework development project to do permission control using the Srbac extension.
In the process of building a framework model, I encountered this problem:
After using the GII to generate the user Model and user controller and a series of pages, I configured Superuser permissions.
The authorized operations include: Userindex,userview,userdelete,userupdate,usercreate,useradmin
Somehow, the only useradmin (http://mysite/index.php?r=user/admin) hint is not authorized.
Error 403 You are not authorized to perform this action
Other licensing operation is not a problem, in addition I download Srbac blog example, based on its code to add user-managed permissions operation, is still useradmin does not take effect.
In tracking Sbasecontroller This class, I found $controller this variable in the access User/admin when the value of the site, the other User Management page $controller value is user.
Solve ~
Reply to discussion (solution)
All the way the great God to help Ah, one night a reply is not.
?? The frame is too biased, use less people, build?
Error 403
You are not authorized to perform this action
?? Start, reverse Find??,?? Take a look at the Var_dump ().
?? The frame is too biased, use less people, build?
Error 403
You are not authorized to perform this action
?? Start, reverse Find??,?? Take a look at the Var_dump ().
Thank you for your reply, the problem has been solved.
The cause of the problem is the function filters () in controller.php:
Return Array (' AccessControl ', ' postonly + delete ',);
The code generated by default for the GII only allows the delete request to be submitted by post. The framework identifies the useradmin operation as a delete and removes the filters problem resolution.
?? The frame is too biased, use less people, build?
Error 403
You are not authorized to perform this action
?? Start, reverse Find??,?? Take a look at the Var_dump ().
Thank you for your reply, the problem has been solved.
The cause of the problem is the function filters () in controller.php:
Return Array (' AccessControl ', ' postonly + delete ',);
The code generated by default for the GII only allows the delete request to be submitted by post. The framework identifies the useradmin operation as a delete and removes the filters problem resolution.
???
In fact, the main is the Yii self-contained validation rules accessrules inside limits
Array (' Allow ', ' actions ' =>array (' index ', ' View ', ' admin '),
' Users ' =>array (' * '),
),
Add ' admin ' to it.
Thank you, finally found the problem, this post is very good