[EXTENSION] Rights

Actually it shouldn’t even be faster but the data do consume a bit less space, which only makes a difference if you have a huge amount of data.

I’d advice you to not use MyISAM because it doesn’t guarantee that your data is stored in a consistent manner. Actually it doesn’t guarantee that your data is stored at all. Remember that MyISAM doesn’t support transactions.

Then there’s also the fact that MyISAM tables can crash and require periodical optimization, which InnoDB tables doesn’t. There’s also less room for performance optimization with MyISAM.

The choice of engine doesn’t matter that much for small projects but from my experience I’d definitely advice you to always use InnoDB.

Hey Wiktor,

What you’re saying sounds wierd, I’ve noticed some problems with renaming authorization items and you’re right, the foreign key should take care of this. This is exactly why I don’t like FKs… Please let me know if you can find out more about this problem.

Hey feby_lho,

The Rights -table is currently only used for sorting of authorization items. So if you didn’t re-order your items it will be empty (drag & drop in the grid views).

Also, defaultRoles should always be and array, e.g. array(‘Guest’).

about modelController class that extends Controller, the function filters and accessrules inside the class, what the effect with rights module, should I change these instead of using default generated code by gii?

Hello Chris,

not sure if this is an issue with your code. It’s rather the database, but I have no idea what’s wrong. I tried to change the super user to the user with id = 2. Here is what I got:

The point is that… AuthItem “Admin” exists and… I didn’t change the itemname column at all!

Any ideas?

Nice

Hi.

I’ve just downloaded Rights with blog.

When I’m trying to get to this in fresh app I’ve got error:

“include(RController.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory”

And actually I cant find that file in the .zip file.

Any ideas ?

Hi, Headshaker,

the file RController should be located in folder application.modules.rights.components. To be included, you should add the following lines in your main configuration file (application/protected/config/main.php):


	

// ...

'import'=>array( 

  'application.models.*',

   'application.components.*', 		

  'application.modules.rights.*',       		// this line is also needed

  'application.modules.rights.components.*', 	// add this line

),

///etc ...



hope this helps

B)

Hey,

I’ve a problem with Rights. When I log into application I can navigate normally within menus, but when I go to index.php?r=rights (or any other Rights related page) my main navigation items get the /rights prefix. So for example index.php?r=site/index becomes index.php?r=rights/site/index

Any idea of the problem ?

Thanks,

Siim

Hi Slim,

I think you need to put a leading slash into your link parameters.

If you’ve ‘site/index’ this means your link is a relative link and if you’re in a module it’s relative to the module.

Use ‘/site/index’ in the menu and it should be fine.

Best regards,

schmunk

Hey, thaks for reply.

First, it’s Siim (spelled as Seem) :)

Second, You’re totally right, so thank you for making it clear for me :)

Siim

How to configure a CMenu’s link (for example) with different rights access ?

for a guest user it’s:

 'visible'=&gt;Yii::app()-&gt;user-&gt;isGuest

and the others plz ?


'visible'=>Yii::app()->user->checkAccess('operation')

http://www.yiiframework.com/doc/api/1.1/CWebUser#checkAccess-detail

Thanks :)

Hi. I was reading posts before with the problem


Error 403


There must be at least one superuser!

I installed yii-user module (It’s working) but I still have this problem with Error 403.

Have anyone tried to connect togethr this two modules ??

If You need my codes let me know from which one files.

I’ll post them later because actually I don’t know what You need to help me solve my problem.

Thanks

Edit: [color="#FF0000"]SOLVED[/color]

I’have made one maybe stupid thing.

I have added tables manually to my MySql database.

I have deleted them and start installer again.

Everything works !

I think there should be separate message for this or something :)

Hello, I’m in the middle of development and i’m facing strange Rights problem.

I can’t access /rights even as superuser account.

trace:

exception ‘CHttpException’ with message ‘(403) not authorized…’ in

yii\framework\web\auth\CAccessControlFilter.php:157

Stack trace:




#0 yii\framework\web\auth\CAccessControlFilter.php(119):

CAccessControlFilter->accessDenied(Object(RWebUser), 'Nie jeste?? upo...')

#1 yii\framework\web\filters\CFilter.php(39):

CAccessControlFilter->preFilter(Object(CFilterChain))

#2 yii\framework\web\CController.php(1122):

CFilter->filter(Object(CFilterChain))

#3 yii\framework\web\filters\CInlineFilter.php(59):

CController->filterAccessControl(Object(CFilterChain))

#4 yii\framework\web\filters\CFilterChain.php(130):

CInlineFilter->filter(Object(CFilterChain))

#5 yii\framework\web\CController.php(283):

CFilterChain->run()

#6 yii\framework\web\CController.php(257):

CController->runActionWithFilters(Object(CInlineAction), Array)

#7 yii\framework\web\CWebApplication.php(328):

CController->run('')

#8 yii\framework\web\CWebApplication.php(121):

CWebApplication->runController('rights')

#9 yii\framework\base\CApplication.php(155):

CWebApplication->processRequest()

#10 index-dev.local.php(15): CApplication->run()

#11 {main} REQUEST_URI=/index-dev.local.php/rights?showlog



Any ideas?

SOLVED

I did override of getName() in my User model. These override caused access denied.

Hi!

I have some roles in my app.

User who create a group should be assign for "admin" role,

and he should have opportunity for create another user for manage this group, and assign him for role like "admin","editor" etc.

How to do this?

Are there any digrams explain the tables relationships?

I used in my app with user-yii extension.

I’ve installed Rights and Yii-user and it works fine… BUT…

At first i thought I could avoid modifying the code of an extension to be able to update it later with no problem. But that is not possible. The yii user code must be modified if you want, for example, assign a default role to a freshly registered user or have multiple profiles by roles.

Secondly, I’ve created Authorization items for the user module so no user other then admin is able to see the default list given by index.php/user/ (index action). Without success however this task is assigned to no role ! (So only the admin should see the list, right ?)

Furthermore, I’ve noticed that by seeing the list the user could also click on an item (user name) and go to its detail view !!!

What I did is edit the userController.php (in yii-user) and modify the filter to comply with rights


return array(

                        'rights',

                );



and remove the rule part.

Then there was an improvement, the list was still visible but not the view detail anymore.

So I have two questions :

  1. Is changing the controllers of the user extension the right move or is there another way to achieve default role assignment upon registration ?

  2. Why the user.default.index is still accessible after having

a.Created the tasks related to these action in rights and assigned it to none

b.Modified the userController to integrate ‘rights’ ?

Am i the only one experiencing this ?

Regards,

xavier

Ok, the problem is solved ! If you plan to use rights with the extension yii-user you MUST change the userController and defaultController of this extension and add this to both of them. Maybe it’s written somewhere already but I haven’t seen it.


 

public function filters()

	{


            return array(

			'rights',

		);

        }



Cheers