[EXTENSION] Rights

Thus, function works.

The problem remains.

Hi I have a problem. Maybe someone knows how to solve it.

Introduce it in the screenshots. When I click on the link below this error comes out.

after installing the module I got a Fatal error: Class ‘Controller’ not found in /protected/modules/rights/controllers/AssignmentController.php on line 9

Can you help?

thanks

@Bulwaria: There was a minor bug in the permission data provider. I’ve fixed it, please update and the problem should be solved.

@mzoli: I’ve changed the module controllers to extend the provided controller so now it should work fine even if you have not generated your web application with yiic.

As a side now I might mention that I’m pretty busy at the moment with other projects but I’ll try to make time to answer questions in the future as well.

Ok I found, was enough to change the database table names:)

The day has come, Rights version 1.0.0 has finally been released!

The latest version had been available for download for quite a long time and no bug reports had been made so I decided to make an official 1.0.0 release. However, if you find a bug please report it on Google Code and I will take a look at it as soon as I have time.

Thanks to everyone for the support.

has anyone managed to integrate the user management of yii-user with the authentication of rights?

that is what I’m looking for, guess I’ll extend from yii-user.

I do not see a problem doing this. Maybe I’m understanding you wrong, could you be a bit more specific of what the problem is?

I have successfully integrated Yii-User with Rights. No problems here. ;)

Hello, I have a litle problem with this extention.

After installation, I can’t see menu :


/**

	* @property string the name of the role with superuser priviledges.

	*/

	public $superuserName = 'Administrateur';

	/**

	* @property string the name of the guest role.

	*/

	public $authenticatedName = 'Membre';

	/**

	* @property string the name of the guest role.

	*/

	public $guestName = 'Visiteur';

	/**

	* @property array list of default roles.

	*/

	public $defaultRoles = null;

	/**

	* @property string the name of the user model class.

	*/

	public $userClass = 'User';

	/**

	* @property string the name of the id column in the user table.

	*/

	public $userIdColumn = 'id';

	/**

	* @property string the name of the username column in the user table.

	*/

	public $userNameColumn = 'username';

The Id Column and username column are correct.

For userclass I use an extension ("yii-user"). The name is correct ?

Thanks for your help, and i am sorry for my poor english.

Hello Co-k-ine,

Have you configured your user to use RightsWebUser or an user that is extended out of that class?

Also, please do NOT change the module code, you can configure it from your application config like so:




'rights'=>array(

	'superuserName'=>'Administrateur',

	'authenticatedName'=>'Membre',

	'guestName'=>'Visiteur',

);



Thanks for the extension, works like a charm!

Tho i had problems in the beginning. I had to declare the lowercase versions of table names in the main config, because after installing, mysql (re)named them like that.


        'authManager'=>array(

            'class'=>'RightsAuthManager',

            'connectionID'=>'db',            

            'assignmentTable'   => 'authassignment',

            'itemTable'         => 'authitem',

            'itemWeightTable'   => 'authitemweight',

            'itemChildTable'    => 'authitemchild',

        )

,

Hello,

I have restaure original setting, but it does not work !

In my configuration file I have :





<?php

	'components'=>array(

		'user'=>array(

			'class'=>'RightsWebUser',

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

		),

                 ...

            );

?>



For my auth extension, I use yii-user, Have you an idea to solve my problem ?

Thanks for your help.

Hi,

I think there is problem with defaultRoles when I use in my controller function filters() { return array(‘rights’); } then the function from CDBAuthManager->checkAccessRecursive has $this->defaultRoles null

so, somwhere it must to be set

As in every standard RBAC, it is just another level of permissions system. You can have roles (for example: sys-admin), which may contain operations (among which you have for example: manage-posts) and operations itself contains task (like for example: new-post, delete-post, edit-post etc., which are all part of manage-post operation).

Three level access control is made as it was found most flexible for most solutions. You may want to assign manage-post operation not only to sys-admin role (which on most systems is most powerful kind of user) but also to for example editor role. Going this way, you might need to give someone only rights for editing and creating posts but not to delete them. In this situation, you create new operation, for example edit-only-posts which differs from manage-posts operation in the way that it does not include delete-post task. And you can assign edit-only-posts operation to other roles than you would assign manage-posts operation.

Does above explanation makes any sense to you?

AFAIK, as in every standard RBAC any bizrule should return BOOLEAN - i.e.: true/false telling RBAC if current role can be executed (assigned) in current situation. It can’t return INTEGER, like in your example.

It’s possible that you’ve find an issue but could you make sure that it’s actually an issue in the module. I took a quick look and it should be correct. The logic is the following:

[list=1]

[*]Get the default roles from the config (default value is null)

[*]If the default roles are not set we use an array with the guestName (name of the guest role)

[*]Default roles are passed to the Authorizer component

[*]Authorizer gets the application authorization manager (which should be RightsAuthManager or a class extended form that class)

[*]Authorizer sets it’s default roles as the authorization manager default roles.

[/list]

I don’t see what could go wrong but please let me know if there is a bug and I will fix it as soon as possible.

Terrific, terrific extension!

I’m very new to Yii and currently overcoming the small learning curve.

I didn’t see anything in the documentation that explained the biz rules and how they can be used. I understand we can place some PHP code in there that gets evaluated, but how “deep” can we go?

For example, here’s what I want to do:

I have a task called "Get Quote". I want to allow Unregistered (Not logged in) to be able to get 5 quotes in a 24 hour period, but after that, they must register or sign in to get any more.

Role "Registered" will be able to get nn quotes in a nn hour period…

Role "Employees" will be able to get unlimited quotes.

etc…

Basically, I’m trying to determine if this functionality could live in the bizrule (or a function called by the bizrule, for example “<? return(userAllowedToGetQuote()); ?>” or if it’s really going to be more part of the controller.

Thanks!

Hello Marcus,

Yii’s documentation about business rules can be found at:

http://www.yiiframework.com/doc/guide/1.1/en/topics.auth#role-based-access-control

I always try to keep the business rules as simple as possible because they tend to affect the application performance. However, if you need complicated business rules at least I would place the functionality within a function.

Super extension! :)

Just a small heads up for anyone who wants to apply their own theme to the Rights module:

First, you need to modify rights.views.layouts.rights.php - change the first line:


<?php $this->beginContent('application.modules.admin.views.layouts.main'); ?>



I set it to my admin module layout.

Then, check your CSS for your theme.

Rights needs to have padding in the ‘content’ id:


#content {

	padding: 20px;

}



Without the padding, you can’t use it because the assignment dropdown menu is locked.

Strange, but true.

I spent a long time figuring this one out. ;)

Hmm wierd, could you be a bit more specific what the problem was without having the padding on the content? Maybe it’s something that can be fixed within the module or added to the documentation…

Thanks in advance. :)