Yii Framework Forum: [EXTENSION] Rights - Yii Framework Forum

Jump to content

  • (31 Pages)
  • +
  • « First
  • 3
  • 4
  • 5
  • 6
  • 7
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] Rights Yii access control evolved. Extensive web interface for CDbAuthManager Rate Topic: ***** 25 Votes

#81 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 417
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 06 September 2010 - 05:01 AM

View PostFlinx, on 06 September 2010 - 04:41 AM, said:

Very nice implementation. :-)

Do you plan to extend with a user registration part or do you know one that I should use in cooperation to Rights?

Thanks in advance


Thanks for the props! I'm glad to hear that you like it.

I have no plans of extending this module to do anything that is not directly associated with access control.
I might make a separate module for user management later if I can find the time.

If you don't want to do that yourself you could always use yii-user. I have the impression that it's pretty good.
http://code.google.com/p/yii-user/
Best regards,
Chris

My contribution to the Yii community:
Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#82 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 417
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 06 September 2010 - 05:03 AM

View Postjoeysantiago, on 06 September 2010 - 02:18 AM, said:

Good morning, Chris! :)

wow, amazing how frequently you review your module... thanks a lot.

of course i'll update italian translations as soon as possible. now i'll install the new version of the module!

geetings,

federico


I want it to be as good as it can be. I'm almost satisfied now and that's quite a lot coming from a perfectionist. :)

Let me know how it went.
Best regards,
Chris

My contribution to the Yii community:
Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#83 User is offline   Raoul 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 598
  • Joined: 29-November 08
  • Location:Paris, France

Posted 06 September 2010 - 01:36 PM

Hi Chris,
I've installed the latest release and everything works fine 'out of the box' ...except (of course ;)) I'm getting the following JS error :

$tbody.sortable is not a function
http://localhost/project/yii-1.1.3/assets/346a9ce9/js/rights.js
Line 133


This occurs on following grid view :

  • rights/authItem/roles
  • rights/authItem/tasks
  • rights/authItem/operations


For 'assignations' and 'Permissions' no error. This is not really a problem to use the extension, but as the perfectionist you are, I thought you would like to know ;)

(by the way, I will send you updated french message files as soon as possible)
ciao
B)
0

#84 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 417
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 06 September 2010 - 04:33 PM

@raoul: Are you running the latest version with zii checked out from the yii repository (after zii was merged into the yii repository)? It would seem like your application doesn't find the jquery-ui script file. I've tested that it works as it should. If everything is working as it should, it should be possible to register jquery-ui as a core script. Please check the yii change log for further information.
Best regards,
Chris

My contribution to the Yii community:
Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#85 User is offline   Raoul 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 598
  • Joined: 29-November 08
  • Location:Paris, France

Posted 06 September 2010 - 05:23 PM

You're right .... it works fine now !
8)
0

#86 User is offline   unbelievable luck 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 08-September 10

Posted 08 September 2010 - 06:33 PM

hello

i just installed version 9.11
the install script went ok, but there is not menu in the interface - i don't see any of the buttons i see in the screen shots - Permissions, assignments, etc. the ?r=rights page loads with a table of users with no navigation items.


also, i see you created a table called AuthItemWeight. i need to use a custom name for the table, specifically have a prefix of tbl_, (this is already in my db config).

in my config i put the following and it seems to be using my table names ok:

'authManager'=>array(
//'class'=>'CDbAuthManager',
'class'=>'RightsAuthManager',
// The database component used
'connectionID'=>'db',
// The itemTable name (default:authitem)
'itemTable'=>'auth_item',
// The assignmentTable name (default:authassignment)
'assignmentTable'=>'auth_assignment',
// The itemChildTable name (default:authitemchild)
'itemChildTable'=>'auth_item_child',
),


thanks
0

#87 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 417
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 09 September 2010 - 01:12 AM

@unbelievable luck: You could configure your authorization manager as following before you run the installer (the installer uses the authorization manager table names when inserting the tables):

'authManager'=>array(
	// The authorization manager (default: CDbAuthManager)
	'class'=>'RightsAuthManager',
	// The database component used
	'connectionID'=>'db',
	// The itemTable name (default: AuthItem)
	'itemTable'=>'auth_item',
	// The assignmentTable name (default: AuthAssignment)
	'assignmentTable'=>'auth_assignment',
	// The itemChildTable name (default: AuthItemChild)
	'itemChildTable'=>'auth_item_child',
	// The itemWeightTable (default: AuthItemWeight)
	'itemWeightTable'=>'auth_item_weight',
),

About the problem with the menu, could you check if the CMenu-widget is rendered at all and that the user you're logged in as is a superuser. You can check this with:

Yii::app()->user->checkAccess(Rights::module()->superuserName)

(In the next version you can simply do Yii::app()->user->isSuperuser but not in 0.9.11.)

I see the menu fine in all my test installations but maybe you've found a bug.
Best regards,
Chris

My contribution to the Yii community:
Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#88 User is offline   unbelievable luck 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 08-September 10

Posted 09 September 2010 - 09:05 AM

i am logged in as superuser.

i'm not quite sure how to check if the menu is rendered, but when i look at the html source code, i have div with id "menu" that is empty. also an empty "flashes" div.


<div id="menu">


</div>


<div class="flashes">

</div>



View PostChris83, on 09 September 2010 - 01:12 AM, said:

@unbelievable luck: You could configure your authorization manager as following before you run the installer (the installer uses the authorization manager table names when inserting the tables):

'authManager'=>array(
	// The authorization manager (default: CDbAuthManager)
	'class'=>'RightsAuthManager',
	// The database component used
	'connectionID'=>'db',
	// The itemTable name (default: AuthItem)
	'itemTable'=>'auth_item',
	// The assignmentTable name (default: AuthAssignment)
	'assignmentTable'=>'auth_assignment',
	// The itemChildTable name (default: AuthItemChild)
	'itemChildTable'=>'auth_item_child',
	// The itemWeightTable (default: AuthItemWeight)
	'itemWeightTable'=>'auth_item_weight',
),

About the problem with the menu, could you check if the CMenu-widget is rendered at all and that the user you're logged in as is a superuser. You can check this with:

Yii::app()->user->checkAccess(Rights::module()->superuserName)

(In the next version you can simply do Yii::app()->user->isSuperuser but not in 0.9.11.)

I see the menu fine in all my test installations but maybe you've found a bug.

0

#89 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 417
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 10 September 2010 - 03:08 AM

Anyone else who can't see the menu?

I have to look into this.
Best regards,
Chris

My contribution to the Yii community:
Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#90 User is offline   luc 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 211
  • Joined: 22-June 10
  • Location:france

Posted 13 September 2010 - 03:51 AM

Hi,
I'm having troubles to make rights extension installed as a nested module. Here's my main.php config file:

    'import'=>array(
        'application.models.*',
        'application.components.*',
                'application.extensions.nestedset.*',
                'application.modules.membres.rights.components.*',
        'application.modules.membres.rights.models.*',
                'application.modules.membres.components.*',
                'application.modules.membres.models.*',
        //'application.modules.rights.components.*',
        //'application.modules.rights.models.*',
    ),

    'modules'=>array(
        // uncomment the following to enable the Gii tool
        
        'gii'=>array(
            'class'=>'system.gii.GiiModule',
            'password'=>'XXXX',
        ),
               /* 'membres' => array(
            'modules'=>array('rights'),
            ),*/
        'membres'=>array(
            'modules'=>array('rights'=>array('install'=>true),),
            )
         ), 

    // application components
    'components'=>array(
        'user'=>array(
            // enable cookie-based authentication            
                     // 'class' => 'application.modules.user.components.YumWebUser',
                      'allowAutoLogin'=>true,
                      'loginUrl' => array('/membres/login'),
            'class' => 'RightsWebUser',
                ),
        'authmanager' => array(
            // The authorization manager (default: CDbAuthManager)
            'class'=>'RightsAuthManager',
            // The database component used
            'connectionID'=>'db',
            // The itemTable name (default: AuthItem)
            'itemTable'=>'auth_item',
            // The assignmentTable name (default: AuthAssignment)
            'assignmentTable'=>'auth_assignment',
            // The itemChildTable name (default: AuthItemChild)
            'itemChildTable'=>'auth_item_child',
            // The itemWeightTable (default: AuthItemWeight)
            'itemWeightTable'=>'auth_item_weight',

        ),


RightsModule.php is modified with:
public $baseUrl = '/membres/rights';


And here's the error I've got:

Alias "rights.RightsModule" is invalid. Make sure it points to an existing PHP file.

Hey Ho !
Let's go !
0

#91 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 417
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 13 September 2010 - 04:36 AM

@luc: You could try to change your import path to:

'application.modules.membres.modules.rights'

Also, don't change anything in the RightsModule.php, you can configure it's properties.
In other words, configure rights like so:

'modules'=>array(
	'membres'=>array(
		'modules'=>array(
			'rights'=>array(
				'install'=>true, // Remove after install of course...
				'baseUrl'=>'/membres/rights',
			),
		),
	),
),

Let me know if this solved your problem.
Best regards,
Chris

My contribution to the Yii community:
Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#92 User is offline   luc 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 211
  • Joined: 22-June 10
  • Location:france

Posted 13 September 2010 - 05:06 AM

View PostChris83, on 13 September 2010 - 04:36 AM, said:

@luc: You could try to change your import path to:

'application.modules.membres.modules.rights'

Also, don't change anything in the RightsModule.php, you can configure it's properties.
In other words, configure rights like so:

'modules'=>array(
	'membres'=>array(
		'modules'=>array(
			'rights'=>array(
				'install'=>true, // Remove after install of course...
				'baseUrl'=>'/membres/rights',
			),
		),
	),
),

Let me know if this solved your problem.

Hi, thank you for your support.
Now, I've got:
Property "CPhpAuthManager.db" is not defined.



EDIT
Ok,it was just a mistyped declaration of authManager in main.php.
It works well now.
Many thanks for your help and this nice extension.
Luc
Hey Ho !
Let's go !
0

#93 User is offline   S@nya 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 15-September 10

Posted 15 September 2010 - 03:28 AM

After operation preservation, we receive an error in line 00451.
Though all data remains.
PHP Error
Описание

preg_match() [<a href='function.preg-match'>function.preg-match</a>]: Compilation failed: missing terminating ] for character class at offset 30
Исходный код

I:\home\league.ru\www\protected\modules\rights\components\RightsAuthorizer.php(451)

00439:         // Loop through the language constructs
00440:         foreach( $languageConstructs as $lc )
00441:             if( preg_match('/'.$lc.'\ *\(?\ *[\"\']+/', $code)>0 )
00442:                 return null; // Language construct found, not safe for eval
00443: 
00444:         // Get a list of all defined functions
00445:         $definedFunctions = get_defined_functions();
00446:         $functions = array_merge($definedFunctions['internal'], $definedFunctions['user']);
00447: 
00448:         // Loop through the functions and check the code for function calls
00449:         // Append a '(' to the functions to avoid confusion between e.g. array() and array_merge()
00450:         foreach( $functions as $f )
00451: if( preg_match('/'.$f.'\ *\({1}/', $code)>0 )
00452:                 return null; // Function call found, not safe for eval
00453: 
00454:         // Evaluate the safer code
00455:         $result = @eval($code);
00456: 
00457:         // Return the evaluated code or null if the result was false
00458:         return $result!==false ? $result : null;
00459:     }
00460: 
00461:     /**
00462:     * @return RightsAuthManager the authorization manager
00463:     */

Содержимое стека

#0 I:\home\www\protected\modules\rights\components\RightsAuthorizer.php(451): preg_match()
#1 I:\home\www\protected\modules\rights\components\RightsAuthorizer.php(76): RightsAuthorizer->sanitizeExpression()
#2 I:\home\www\protected\modules\rights\controllers\AuthItemController.php(303): RightsAuthorizer->updateAuthItem()
#3 I:\home\www\core\web\actions\CInlineAction.php(50): AuthItemController->actionUpdate()
#4 I:\home\www\core\web\CController.php(300): CInlineAction->run()
#5 I:\home\www\core\web\filters\CFilterChain.php(133): AuthItemController->runAction()
#6 I:\home\www\core\web\filters\CFilter.php(41): CFilterChain->run()
#7 I:\home\www\core\web\CController.php(1049): CAccessControlFilter->filter()
#8 I:\home\www\core\web\filters\CInlineFilter.php(59): AuthItemController->filterAccessControl()
#9 I:\home\www\core\web\filters\CFilterChain.php(130): CInlineFilter->filter()
#10 I:\home\www\core\web\CController.php(283): CFilterChain->run()
#11 I:\home\www\core\web\CController.php(257): AuthItemController->runActionWithFilters()
#12 I:\home\www\core\web\CWebApplication.php(324): AuthItemController->run()
#13 I:\home\www\core\web\CWebApplication.php(121): CWebApplication->runController()
#14 I:\home\www\core\base\CApplication.php(135): CWebApplication->processRequest()
#15 I:\home\www\index.php(13): CWebApplication->run()

0

#94 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 417
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 15 September 2010 - 07:36 AM

@s@nya: I'm not exactly sure I understand what the problem is. Could you tell me the necessary steps I need to take to reproduce this exception?
Best regards,
Chris

My contribution to the Yii community:
Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#95 User is offline   S@nya 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 15-September 10

Posted 15 September 2010 - 12:31 PM

Has found out that the given problem occurs on PHP 5.2.12 (Denwer). On PHP 5.3.3 such problems aren't present.

Operations procedure:
1. Click Task (Operations)
2. Enter the Description
3. Click Save

and we receive the given error. All data thus saves.

PS. Sorry for my bad English
0

#96 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 417
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 20 September 2010 - 01:35 AM

View PostS@nya, on 15 September 2010 - 12:31 PM, said:

Has found out that the given problem occurs on PHP 5.2.12 (Denwer). On PHP 5.3.3 such problems aren't present.

Operations procedure:
1. Click Task (Operations)
2. Enter the Description
3. Click Save

and we receive the given error. All data thus saves.

PS. Sorry for my bad English


Hello again S@nya,

May I ask what data you had in your data field at the time you got this error?

There seems to be a syntax error in the string given entered into the data field..
Best regards,
Chris

My contribution to the Yii community:
Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#97 User is offline   S@nya 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 15-September 10

Posted 20 September 2010 - 02:20 AM

I entered description of task. Click Save. Recive error.
0

#98 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 417
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 20 September 2010 - 07:22 AM

View PostS@nya, on 20 September 2010 - 02:20 AM, said:

I entered description of task. Click Save. Recive error.


Was the data field even visible in the form? Have you enabled in the module configuration?
It's only data that uses the RightsAuthorizer::sanitizeExpression method in which your exception was thrown.

I'm having a hard time to reproduce this..

What kind of description did you enter? Could you post the text so that I can reproduce this problem?

I'm running with php 5.2.11. I guess I have to try with php 5.2.12.
Best regards,
Chris

My contribution to the Yii community:
Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#99 User is offline   S@nya 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 15-September 10

Posted 21 September 2010 - 03:31 AM

Posted Image
Posted Image
Posted Image

go back
Posted Image
0

#100 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 417
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 23 September 2010 - 07:00 AM

@S@nya: Thanks for the detailed screenshots.

The data field does not currently support function calls for security reasons. I will check if it would be possible to allow some function calls when I can find the time to do so.

Could you make sure that this is the problem by checking the same without calling a function.
Best regards,
Chris

My contribution to the Yii community:
Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

Share this topic:


  • (31 Pages)
  • +
  • « First
  • 3
  • 4
  • 5
  • 6
  • 7
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users