Ah yeah… of course, it’s the filter chain for the action you’re running, the filterUpdateOwn is not a part of the filter chain for actionDelete. Therefore the ‘rights’ filter is at index 1.
Ah yeah… of course, it’s the filter chain for the action you’re running, the filterUpdateOwn is not a part of the filter chain for actionDelete. Therefore the ‘rights’ filter is at index 1.
Hi Chris,
Is there an easy way to filter the users that are shown? What I am trying to accomplish is this. I have a site using rights, but I really only need to use rights for the "staff" using the site. I have a table with the list of user ids that designate that they are staff. Is there a way to for me to put a "InCondition" somewhere in the rights code that would only show the users whos ID were in that staff table?
I hope this makes sense.
Just for you info, here’s a github clone of yii-rights.
Created like this:
git svn clone -s http://yii-rights.googlecode.com/svn/ yii-rights
git remote add origin git@github.com:schmunk42/yii-rights.git
Best regards,
schmunk
I’ve using Rights quite a long time. Thanks for the great extension
By the way, I’ve just realised that the table of the User must not have “name” column, or else it will conflict with the attached behavior on RAuthorizer. Rights will prefer the table’s “name” column rather than Rights’ userNameColumn. Is there any way for workaround?
Hello,
Newbie trying…
> Ha! Not hard enough.
> Would like to thank the user ‘mdomba’ for a post that reminded me how to enable errors via PHP to debug properly. All you Newbie’s make sure your php5/apache#/php.ini has the appropriate setting to see the contents of those blank pages.
> Time for a coffee.
> Enjoy!
Installed Yii, done.
Installed Yii-user, done.
Trying rights, no dice. What is the scoop with the User model; if I have Yii-user installed is its model correct or does a model via yiic, or manually, have to be created?
If the user name is admin, like it is in a blank installation, note the case, should the config be changed from Admin to admin? Am I out in left field here…
Steps:
I copied the folder in to modules and gave permissions, I then changed my config main and I have triple checked everything there, but I get a blank screen when loading the site or with the rights path. It was working before hand with Yii-user extension so I am at a loss if things have to be tweaked other than the basic.
Any help would be most appreciated.
Thanks in advance.
Newbie still trying…
> Have no idea why it worked; I think there is a cache issue with apache or the browser but I deleted the tables again, ran the index.rights, got same 403, then hit refresh and sure enough got the congrats…
> Time to check it out - so much more to learn but progress is being made.
> Now time for scotch! Enjoy!
I have the site running but when index.php/rights I get a 403 . See details below.
In the config I have the superuserName attribute set for rights. Guess I am still missing the ball a bit.
Also, I noticed there is no data in the rights tables after I installed with flag and loaded the site. I don’t know if that is the norm. I installed the tables manually as well…
Thanks in advance.
exception ‘CHttpException’ with message 'There must be at least one
superuser!’ in
/var/www/html/fr0/protected/modules/rights/components/RAuthorizer.php:305
Stack trace:
#0
/var/www/html/fr0/protected/modules/rights/controllers/AssignmentController.php(51):
RAuthorizer->getSuperusers()
#1 /var/www/yii-0/framework/web/CController.php(1121):
AssignmentController->accessRules()
#2 /var/www/yii-0/framework/web/filters/CInlineFilter.php(59):
CController->filterAccessControl(Object(CFilterChain))
#3 /var/www/yii-0/framework/web/filters/CFilterChain.php(130):
CInlineFilter->filter(Object(CFilterChain))
#4 /var/www/yii-0/framework/web/CController.php(283): CFilterChain->run()
#5 /var/www/yii-0/framework/web/CController.php(257):
CController->runActionWithFilters(Object(CInlineAction), Array)
#6 /var/www/yii-0/framework/web/CWebApplication.php(328):
CController->run(’’)
#7 /var/www/yii-0/framework/web/CWebApplication.php(121):
CWebApplication->runController(‘rights’)
#8 /var/www/yii-0/framework/base/CApplication.php(155):
CWebApplication->processRequest()
#9 /var/www/html/fr0/index.php(13): CApplication->run()
#10 {main} REQUEST_URI=/fr0/index.php/rights
Just set up another project from scratch. These are the steps I performed to get it to work properly.
yii-1.1.8.r3324
yii-rights-1.3.0.r147
Installed webapp from shell: yiic webapp <projectname>
Extracted Yii Rights into protected/modules
Modified protected/config/main.php, following instructions in Yii Rights Doc 1.2.0
Created User model using gii
Overwrote protected/components/UserIdentity.php with demos/blog/protected/components/UserIdentity.php (the demos come with the Yii zip download)
Add public function validatePassword() in User model (User.php)
Ensured that the database had a User table with id and username fields
Ensured that the first id (id=1) in User table had username of "admin"
8 ) Logged into admin account (gave error message after login, but still logged in fine)
Hello, thanks for the module…
I have installed the module in /protected/modules/rights and it works well. But I have a problem in overriding the baseUrl.
My site has a different admin page and general user page, example of the url is like this:
> mysite/dashboard (for general users)
> mysite/administration/dashboard (for admin)
My question is, how I can change the url of the ‘rights’ module from /mysite/rights to /mysite/administration/rights ?
I change the config like this:
'rights' => array(
//'install' => true,
'enableBizRuleData'=>true,
'debug'=>true,
'baseUrl'=>'/administration/rights',
'appLayout'=>'application.views.layouts.admin.main'
),
but nothing’s change. Any idea how to solve this?
Thanks,
Hey,
first of all thanks for this great module.
But first I had some problems installing it. Maybe it’s because I’m a Yii beginner.
For me the configuration had to look like this:
//....
'rights'=>array(
'userNameColumn'=>'username',
'flashSuccessKey'=>'success',
'flashErrorKey'=>'error',
),
//....
And in RAuthorizer line 293 it had to be:
$criteria->addInCondition(Rights::module()->userNameColumn, $userIdList);
//instead of
//$criteria->addInCondition(Rights::module()->userIdColumn, $userIdList);
But now it works.
[b][font="Arial"][size="3"][color="#404040"]Help![/color]
[/size][/font]
[font=“Arial”][size=“3”][color="#404040"]I assign the item ‘[/color][color="#404040"]site.login’ to the Guest User, but the Guest User cannot access the ‘/site/login’ url. why? And how to fix it?[/color]
[color="#404040"]p.s. [/color]
[color="#404040"]I didn’t implementing the allowedactions-method. Is the method necessary?[/color]
[color="#404040"]Thanks![/color][/size][/font]
[/b]
I’m so confused. I’m a mildly advanced newbie. Everything appears to be working great, except…
I’m getting the error: “403 - You are not authorized to perform this action.” My superuser account/role does not seem to be working correctly
I am logged in as "admin", which is assigned to a "Master" role, the "Master" role has been set up in the config file as the "superuserName".
Confirmed in the db that there is an AuthItem named “Master”, type 2. And there is a AuthAssignment named “Master”, userid 1. And I’m logged in as “admin” which has an id of 1. Yet I don’t seem to be have superuser access.
Any ideas?
I’m running version 1.3.0 and I’m using yii-user as my user module.
Thanks in advance for your help.
Dirk
Greetings, Dirk, i'm a complete Yii newbie (frankly, i have some PHP expertise, but know little about Yii), and i got the same problem, there were two workarounds for me, both of which i do not recommend, but they will give you a quick solution if you're in a hurry (like i am), at least until somebody gives a better solution, these are:
Assign ‘userNameColumn’ and ‘userIdColumn’ the same value, i made a few tests and realized that the “getSuperusers” function (RAuthorizer.php, line 283, under components) was returning an array with empty values, this was because Rights was trying to (i guess) get a “name” attribute, which does not exist in my model or table, this solution works, but will return userIds instead of userNames, which is what i was expecting, i believe it would be the same for you.
In your RAuthorizer class (in components/RAuthorizer.php), around line 300, change
$superusers[] = $user->name;
to
$superusers[] = $user->yourUserIdField; //In my case, it was $user->usuario;
This way, the username will be displayed as expected in the corresponding tables.
I hope you find this answer useful, nevertheless, i will be expecting a better solution, if there is any, or the confirmation of this being the right path, either from yourself or from someone else with a better understanding of Yii and the Rights extension (which, by the way, i find most interesting and useful) than myself.
Cheers.
Why does nothing happen when I click on delete button for operation, task or roles.
Assignments work, but I can’t delete anything.
Hi!
I get an error message when push "Save" button, after selecting some "Children Relations", on "Task":
PHP Error
preg_match() [<a href=‘function.preg-match’>function.preg-match</a>]: Compilation failed: missing terminating ] for character class at offset 30
/protected/modules/rights/components/RAuthorizer.php(448)
00445: // Loop through the functions and check the code for function calls.
00446: // Append a ‘(’ to the functions to avoid confusion between e.g. array() and array_merge().
00447: foreach( $functions as $f )
00448: if( preg_match(’/’.$f.’\ *\({1}/’, $code)>0 )
00449: return null; // Function call found, not safe for eval.
yii-rights-1.3.0.r147
yii-1.1.5.r2654
yii-user-0.3-r107
Thanks!
Hello there,
is any simple solution to bypass user login based on (UserAgent + IP address) ??
I’m developing an application that uses Rights ext and Adsense, and UA “Mediapartners-Google” often came to crawl the last served page in order to offer context’ ads.
Thanks for any clue,
cbi.
Hi anesed!
Thank you for your solution – I had the same problem and it helped me. The problem, as you have said, is absent "name" field in User model.
I think more correct fix to this problem is to replace
$superusers[] = $user->name;
with
$superusers[] = $user->{Rights::module()->userNameColumn};
This will use module configuration parameter which is defined in main.php
I kindly ask extension developer to fix this problem in the next release, if it’s not already. And thanks for a great extension!
When using Rights in my controller do I need the following code anymore?
public function filters()
{
return array(
'rights',
);
/* Do I need this below <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />? */
return array(
'accessControl', // perform access control for CRUD operations
);
}
/*Do I need this one too? */
public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('index','view'),
'users'=>array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('create','update'),
'users'=>array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions'=>array('admin','delete'),
'users'=>array('admin'),
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}
*/
I am thinking that is it safe to delete the above code (with the exception of the rights filter) is this correct??
Hi Chris,
I was wondering, how can I implement this situation,
I have two roles, manager and staff. Staff is limited to create, view, and index. While manager can update and delete. In the create page, I limit that a staff cannot entry a value bigger than a number. But manager, is allowed to create with any value. I wanted to provide a box contain username and password for the manager, so the manager does not need to login and add all of this by himself, he only needs to input his username and password.
Cheers,
Daniel
Hi,
I’m having trouble installing rights extension on an existing app I’m developing (although I’ve tried to install in another app I’ve created while following a tutorial). The error I’m getting is this when I navigate to index.php/rights
"Alias "rights.RightsModule" is invalid. Make sure it points to an existing PHP file."
Here’s the full stack trace
pastebin . com/grb8Wm2d (Sorry, for stupid link but I can’t paste links… first post )
Here is the main.php relevant configurations:
'import'=>array(
'application.models.*',
'application.components.*',
'application.modules.rights.*', // rights extension
'application.modules.rights.components.*',
),
'modules'=>array(
'rights'=>array(
'install'=>true,
'debug'=>true,
),
),
'components'=>array(
'user'=>array(
'class'=>'RWebUser', // Allows super users access implicitly.
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
// Authorization manager
'authManager'=>array(
'class'=>'RDbAuthManager',
'connectionID'=>'db',
),
The rights version I’m using is 1.3.0.r147.
Any help is greatly appreciated!
Thanks!