Yii extension Srbac, user management (user/admin) No access rights

Source: Internet
Author: User
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.