Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yii-Auth and Menubuilder #83

Closed
larry-tx opened this issue Jul 3, 2013 · 4 comments
Closed

Yii-Auth and Menubuilder #83

larry-tx opened this issue Jul 3, 2013 · 4 comments

Comments

@larry-tx
Copy link

larry-tx commented Jul 3, 2013

Auth and Menubuilder apparently don't get along. I'm getting this response with the both of them in effect:

 Object configuration must be an array containing a "class" element.

L:\xampp\htdocs\larrylutz\protected\extensions\menubuilder\components\EMBRbacDataFilter.php(28)

16 {
17 
18     /**
19      * Get the roles from the authManager
20      *
21      * @param $userId
22      * @return array
23      */
24     protected static function _getRoles($userId)
25     {
26         $roles = array();
27 
28         $authRoles = Yii::app()->authManager->getRoles($userId);
29         if(!empty($authRoles))
30             foreach($authRoles as $role=>$authItem)
31                 $roles[$role]=$authItem->name;
32 
33         return $roles;
34     }

When I was using Rights, I never got this message; it only appeared after installing Auth and removing Rights.

Since Menubuilder is the only game in Yii-town when it comes to a database-driven menu system (an absolute necessity for anything beyond a simple, fairly primitive Web site), I really need an access control system that plays nicely with it. Any ideas how to overcome this with Auth?

@crisu83
Copy link
Owner

crisu83 commented Jul 4, 2013

The problem is that you are missing a class property from a widget
configuration. Did you also upgrade to yiistrap? Try backtacing the issue.
I don't believe that it is related to auth directly.
On Jul 3, 2013 11:33 PM, "LarryTX" notifications@github.com wrote:

Auth and Menubuilder apparently don't get along. I'm getting this response
with the both of them in effect:

Object configuration must be an array containing a "class" element.
L:\xampp\htdocs\larrylutz\protected\extensions\menubuilder\components\EMBRbacDataFilter.php(28)
16 {17 18 /**19 * Get the roles from the authManager20 *21 * @param $userId22 * @return array23 */24 protected static function _getRoles($userId)25 {26 $roles = array();27 28 $authRoles = Yii::app()->authManager->getRoles($userId);29 if(!empty($authRoles))30 foreach($authRoles as $role=>$authItem)31 $roles[$role]=$authItem->name;32 33 return $roles;34 }

When I was using Rights, I never got this message; it only appeared after
installing Auth and removing Rights.

Since Menubuilder is the only game in Yii-town when it comes to a
database-driven menu system (an absolute necessity for anything beyond a
simple, fairly primitive Web site), I really need an access control system
that plays nicely with it. Any ideas how to overcome this with Auth?


Reply to this email directly or view it on GitHubhttps://github.com//issues/83
.

@larry-tx
Copy link
Author

larry-tx commented Jul 4, 2013

That did work! Stupidly, I had forgotten to YiiStrap. But now, I've got a different problem. No matter what I do, when I try to go to /auth, I get "Error 401 Access Denied." I've tried re-enabling Rights, and giving permissions on Auth.* to everyone. I've tried adding (in /modules/auth/controllers/AuthItemController):

public function filters() {
            return array('accessControl'); // perform access control for CRUD operations
        }

        public function accessRules() {

            return array(
                array(
                    'allow',
                    'users' => array('*'),
                ),
                array('deny'),
            );
        }

Literally everything returns a 401.

@crisu83
Copy link
Owner

crisu83 commented Jul 4, 2013

AFAIK you need to configure users for the auth module.

On Thu, Jul 4, 2013 at 4:45 PM, LarryTX notifications@github.com wrote:

That did work! Stupidly, I had forgotten to YiiStrap. But now, I've got a
different problem. No matter what I do, when I try to go to /auth, I get
"Error 401 Access Denied." I've tried re-enabling Rights, and giving
permissions on Auth.* to everyone. I've tried adding (in
/modules/auth/controllers/AuthItemController):

public function filters() {
return array('accessControl'); // perform access control for CRUD operations
}

    public function accessRules() {

        return array(
            array(
                'allow',
                'users' => array('*'),
            ),
            array('deny'),
        );
    }

Literally everything returns a 401.


Reply to this email directly or view it on GitHubhttps://github.com//issues/83#issuecomment-20477835
.

Best regards,
Christoffer Niska
Phone +358 500 980 565
E-mail ChristofferNiska@gmail.com

@larry-tx
Copy link
Author

larry-tx commented Jul 4, 2013

Yii-Users is configured and working quite well with everything else.

'components' => array(
            'user'         => array(
                'class' => 'auth.components.AuthWebUser',
                'admins' => array('Admin'),
                'behaviors'      => array(
                    'application.vendor.schmunk42.web-user-behavior.WebUserBehavior'
                ),
                'allowAutoLogin' => TRUE,
                'loginUrl'       => array('/user/login'),
            ),

Notably, Rights works quite well. That is until I disable rights and enable Auth.

@crisu83 crisu83 closed this as completed Sep 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants