I’m not sure “admin-account” functionality refers to, but note that when migrating from Rights to Auth, one thing I had to do is to implement the isSuperUser feature in my WebUser class; that is something not provided by Auth (but really fast & easy to adapt).
Hi, I’m trying to get a demo yii app with this extension working.
I edited my config/main.php.
When I try to add a role (foobar): yiiapp.local/auth/role/view/name/foobar I get php notice "Trying to get property of non-object" at yiiapp.local/protected/modules/auth/controllers/AuthItemController.php(133)
At first I thought it was a compatibility problem with "user" extension, but this "yiiapp" application is a clean one, with yii-bootstrap and User class took from your demo.
Sounds like a problem with your authorization manager, make sure that you configured it correctly. That error can only occur if the application somehow fails to create the authorization item. I hope this helps you to solve your issue.
Hi, I would first like to thank you for providing this awesome extension. I haven’t had much time with php and even less time with yii so I hope you can bear with me.
While following the documentation I ran into the following:
public function filters()
{
return array(
array('auth.components.AuthFilter'),
)[color="#FF0000"],[/color]
}
I am not really sure if this is a typo but the comma(,) after the last parenthesis should be replaced by a semicolon (? (just want to make sure since I got errors with the comma)
$itemName .= '.' . $controller->action->getId();
if ($user->checkAccess($itemName))
return true;
throw new CHttpException(401, Yii::t('AuthModule.main', 'Access denied.'));
}
}
I am not really sure why it caused the error but I tried replacing it with:
throw new CHttpException(401,‘Access denied.’);
This seemed to fix the error but now only the superuser had access to the tasks (although other roles were configured to have permission).
In the end, instead of using array(‘auth.components.AuthFilter’) I tried using ‘rights’ (filter from your Rights Extension extending Rcontroller). Although I haven’t tested it much it seems to work perfectly.
Again I haven’t had much time with php and yii so maybe everything I said might be completely wrong.
A trivial question but is there a tutorial of how to setup this extension with CPhpAuthManager. To be honest I am struggling to understand how it all fits together and each time I go to the guide to search for guidance I’m thrown away.
[list=1]
[*]I previously was using the basic authentication method using the accessRules() of the Controller and with accessControl in filters.
[*]I managed so far to install the extension along with Bootstrap, set it up to use the bootstrap theme and configure the main.php as per the instructions.
[*]I created a user table with id,name,username,password and role fields and updated the UserIdentity.php authenticate() method to check for the user in the DB. That’s working fine.
[]I went into r=auth with user <<admin>>, and setup several operations like this: item.
[]I created a task name itemAdmin whose child is the item. operation
[*]I created a role named admin whose child is itemAdmin.
[*]I assigned this role to my <<someuser>> user.
[/list]
When loging in as <<someuser>> and trying to access any of the controller actions it says Error 401 Permission denied.
What do I do with the accessControl and accessRules? Do I have to change that?
Well this might be kind of embarrassing since for many this might have been obvious but for the few others that could be struggling these are the steps I took to get it to work. Hope it helps someone.
These are the steps I followed to achieve the use of Auth with CPhpAuthManager.
Create a table and model user with id,name,username,password,role.
Add one user:
[indent]
name= Administrator
username = admin
password = admin
role = admin
[/indent]
Create a basic auth.txt and auth.php file in protected/data (follow Wiki mentioned below)