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

Jump to content

  • (32 Pages)
  • +
  • « First
  • 2
  • 3
  • 4
  • 5
  • 6
  • 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: ***** 27 Votes

#61 User is offline   Chris83 

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

Posted 27 August 2010 - 06:51 PM

Version 0.9.10 is now available.

New features are:

  • Most views now user grid view and data providers
  • Authorization items are now properly sorted according to weights
  • Rights now has its own user behavior
  • Generator now looks for controllers in subfolders


There has been quite a lot of changes made and I've tested also the module quite a lot. However, in case you happen to find a bug please report it on Google Code.

The documentation has also been updated and can be found at:
http://yii-rights.go...-doc.0.9.10.pdf

Enjoy!
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
0

#62 User is offline   saiful 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 27-May 09
  • Location:Indonesia

Posted 28 August 2010 - 06:50 AM

View PostChris83, on 27 August 2010 - 06:51 PM, said:

Version 0.9.10 is now available.


Great.. :)

Should I reinstall or just overwrite the module scripts?
Maybe you write some guide to do it.
Thanks for the conversation,

Saiful
0

#63 User is offline   Chris83 

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

Posted 29 August 2010 - 08:22 AM

View Postsaiful, on 28 August 2010 - 06:50 AM, said:

Great.. :)

Should I reinstall or just overwrite the module scripts?
Maybe you write some guide to do it.


You should read the updated documentation and either reinstall the module or recreate all authorization items you've created for the filter. This is because the naming conventions has been changed to support case-sensitive authorization item names.
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
0

#64 User is offline   Abdul wahab 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 29-August 10

Posted 29 August 2010 - 02:57 PM

View PostChris83, on 19 July 2010 - 03:16 PM, said:

Posted Image

Rights utilizes Yii's built-in database auth manager (CDbAuthManager) to provide a solid web interface for extensive access control.

Features:

  • Manage Operations, Tasks and Roles (authorization items)
  • Create/Update/Delete/View authorization items
  • Add/Remove authorization item children
  • Authorization item weights for sorting
  • Assign/Revoke authorization item assignments
  • Permissions overview
  • Support for business rules (and data)
  • Automatic Controller Access Control (ACAC)
  • Authorization item generator
  • Flash messages
  • Internationalization (I18N)
  • Automated installer for easier set up
  • Works even when nested in other modules
  • Fancy web 2.0 interface
  • Cross-browser and cross-database compatibility
  • Easy to extend


Download directly from Google Code (updated 28th of August):
http://yii-rights.go....0.9.10.r85.zip

Detailed documentation can be found here:
http://yii-rights.go...hts-doc.0.9.10.pdf

Project can be found here:
http://code.google.com/p/yii-rights/ and http://www.yiiframew...tension/rights/

Downloads: http://code.google.c.../downloads/list
Checkout: http://code.google.c...source/checkout

Yii Blog demo with Rights available here (Updated 28th of August):
http://yii-rights.go...-0.9.10.r85.zip

Having trouble with the module?
Take a look at the documentation or the blog example.
You can also post your questions below and I'll try to answer them as soon as possible.

Screenshots of the interface (version 0.9.8):

Posted Image

Posted Image

Posted Image

Posted Image

Posted Image

If you happen to find a bug please report it here or on Google Code and I'll take a look as soon as possible.

Thank you for reading.


hi..i m new to yii...
i have installed the rights module...but when i write the url
"http://localhost/pdf/index.php?r=rights"
in the browser to get the rights....it throws an exception that
"Property "CWebApplication.rights" is not defined."
plz tell me its solution as soon as possible...i am new to yii...i will b very thank full to u...

waiting for response
0

#65 User is offline   Chris83 

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

Posted 29 August 2010 - 04:03 PM

@sufard: You haven't probably added rights to your module configuration. Please refer to the documentation for more information.
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
0

#66 User is offline   Abdul wahab 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 29-August 10

Posted 29 August 2010 - 08:07 PM

View PostChris83, on 29 August 2010 - 04:03 PM, said:

@sufard: You haven't probably added rights to your module configuration. Please refer to the documentation for more information.

ok....let me see it..
thanks for reply...
0

#67 User is offline   Abdul wahab 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 29-August 10

Posted 29 August 2010 - 09:04 PM

View PostChris83, on 29 August 2010 - 04:03 PM, said:

@sufard: You haven't probably added rights to your module configuration. Please refer to the documentation for more information.


this is my main.php file....
plz see it i have done all the work from start but the problem ids same



<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'My Web Application',

// preloading 'log' component
'preload'=>array('log'),

// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
'application.modules.rights.components.*',
),

// application components
'components'=>array(
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
// uncomment the following to enable URLs in path-format
/*
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
*/
/*
'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),
*/
// uncomment the following to use a MySQL database

'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=rights',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
),

'errorHandler'=>array(
// use 'site/error' action to display errors
'errorAction'=>'site/error',
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
// uncomment the following to show log messages on web pages
/*
array(
'class'=>'CWebLogRoute',
),
*/
),
),
),
'import'=>array(
'application.modules.rights.components.*',
),
'components'=>array(
'user'=>array(
'class'=>'RightsWebUser',
),
'authManager'=>array(
'class'=>'RightsAuthManager',
'connectionID'=>'db',
),
),
'modules'=>array(
'rights'=>array(
'install'=>true, // Add this line only if you wish to use the installer.
),
),
'rights'=>array(
'superuserName'=>'Admin', // Name of the role with super user privileges.
'authenticatedName'=>'Authenticated', // Name of the authenticated user role.
'guestName'=>'Guest', // Name of the guest role.
'defaultRoles'=>null, // List of role names that are assigned to all users.
'userClass'=>'User', // Name of the User model class.
'userIdColumn'=>'id_number', // Name of the user id column in the database.
'userNameColumn'=>'username', // Name of the user name column in the database.
'enableBizRule'=>true, // Whether to enable authorization item business rules.
'enableBizRuleData'=>false, // Whether to enable data for business rules.
'flashSuccessKey'=>'RightsSuccess', // Key to use for setting success flash messages.
'flashErrorKey'=>'RightsError', // Key to use for setting error flash messages.
'layout'=>'rights.views.layouts.rights', // Layout to use for displaying Rights.
'baseUrl'=>'/rights', // Base URL for Rights. Change if module is nested.
'cssFile'=>'rights.css', // Style sheet file to use for Rights.
'install'=>false, // Whether to enable installer.
),


// application-level parameters that can be accessed
// using Yii::app()->params['paramName']
'params'=>array(
// this is used in contact page
'adminEmail'=>'webmaster@example.com',
),
);
0

#68 User is offline   saiful 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 27-May 09
  • Location:Indonesia

Posted 30 August 2010 - 03:05 AM

View Postsufard, on 29 August 2010 - 09:04 PM, said:

this is my main.php file....
plz see it i have done all the work from start but the problem ids same
---


please compare with this config:
<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
        'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
        'name'=>'My Web Application',
        
// preloading 'log' component
        'preload'=>array('log'),
        
// autoloading model and component classes
        'import'=>array(
                'application.models.*',
                'application.components.*',
                'application.modules.rights.components.*',
        ),
        
// application components
        'components'=>array(
                'user'=>array(
// enable cookie-based authentication
                        'allowAutoLogin'=>true,
                        'class'=>'RightsWebUser',
                ),
// uncomment the following to enable URLs in path-format
                /*
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
                */
                /*
'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),
                */
// uncomment the following to use a MySQL database
                
                'db'=>array(
                        'connectionString' => 'mysql:host=localhost;dbname=rights',
                        'emulatePrepare' => true,
                        'username' => 'root',
                        'password' => '',
                        'charset' => 'utf8',
                ),
                'authManager'=>array( 
                        'class'=>'RightsAuthManager',
                        'connectionID'=>'db',
                ),
                'errorHandler'=>array(
// use 'site/error' action to display errors
                        'errorAction'=>'site/error',
                ),
                'log'=>array(
                        'class'=>'CLogRouter',
                        'routes'=>array(
                                array(
                                        'class'=>'CFileLogRoute',
                                        'levels'=>'error, warning',
                                ),
// uncomment the following to show log messages on web pages
                        /*
array(
'class'=>'CWebLogRoute',
),
                        */
                        ),
                ),
        ),
        'modules'=>array( 
                'rights'=>array( 
                        'superuserName'=>'Admin', // Name of the role with super user privileges. 
                        'authenticatedName'=>'Authenticated', // Name of the authenticated user role. 
                        'guestName'=>'Guest', // Name of the guest role. 
                        'defaultRoles'=>null, // List of role names that are assigned to all users. 
                        'userClass'=>'User', // Name of the User model class. 
                        'userIdColumn'=>'id_number', // Name of the user id column in the database. 
                        'userNameColumn'=>'username', // Name of the user name column in the database. 
                        'enableBizRule'=>true, // Whether to enable authorization item business rules. 
                        'enableBizRuleData'=>false, // Whether to enable data for business rules. 
                        'flashSuccessKey'=>'RightsSuccess', // Key to use for setting success flash messages. 
                        'flashErrorKey'=>'RightsError', // Key to use for setting error flash messages. 
                        'layout'=>'rights.views.layouts.rights', // Layout to use for displaying Rights. 
                        'baseUrl'=>'/rights', // Base URL for Rights. Change if module is nested. 
                        'cssFile'=>'rights.css', // Style sheet file to use for Rights. 
                        'install'=>true, // Whether to enable installer. 
                ),
        ),
        
// application-level parameters that can be accessed
// using Yii::app()->params['paramName']
        'params'=>array(
// this is used in contact page
                'adminEmail'=>'webmaster@example.com',
        ),
); 

Thanks for the conversation,

Saiful
0

#69 User is offline   Chris83 

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

Posted 30 August 2010 - 04:48 AM

Please note that you don't need to set any configurations for rights unless they are different from the default values.

@sufard: You have the rights module configuration twice.
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
0

#70 User is offline   pingala 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 14-July 10
  • Location:Dublin, Ireland

Posted 30 August 2010 - 09:35 AM

Hi Chris,
it looks like you have created a great piece of code however I am having some difficulties in make it to work.

I've the user model and table created and filled with a user account ('admin'), the main layout has the full path in it (application.views.layouts.main), the config file includes
	
        'components'=>array(
		'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
            'loginUrl'=>array('/user/login'),
            'class'=>'RightsWebUser',
		),
        'authManager'=>array(
            'class'=>'RightsAuthManager',
        ),


and
    'modules'=>array(
        'rights'=>array(
            'superuserName'=>'admin', // Name of the role with super user privileges. 
            'authenticatedName'=>'Authenticated', // Name of the authenticated user role. 
            'guestName'=>'Guest', // Name of the guest role. 
            'defaultRoles'=>null, // List of role names that are assigned to all users. 
            'userClass'=>'User', // Name of the User model class. 
            'userIdColumn'=>'id', // Name of the user id column in the database. 
            'userNameColumn'=>'username', // Name of the user name column in the database. 
            'enableBizRule'=>true, // Whether to enable authorization item business rules. 
            'enableBizRuleData'=>false, // Whether to enable data for business rules. 
            'flashSuccessKey'=>'RightsSuccess', // Key to use for setting success flash messages. 
            'flashErrorKey'=>'RightsError', // Key to use for setting error flash messages. 
            'layout'=>'rights.views.layouts.rights', // Layout to use for displaying Rights. 
            'baseUrl'=>'/rights', // Base URL for Rights. Change if module is nested. 
            'cssFile'=>'rights.css', // Style sheet file to use for Rights. 
            'install'=>true, // Whether to enable installer.            
        ),



however when i load http://localhost/mya...ndex.php/rights or http://localhost/mya.../rights/install
it does redirect me to the main page http://localhost/myapp/index.php. I'm logged in as user 'admin' and I don't have any of the Auth* tables in the database

do you have any idea on what it is missing here?

appreciate your help :)
0

#71 User is offline   saiful 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 27-May 09
  • Location:Indonesia

Posted 30 August 2010 - 10:33 AM

@pingala
try to add connectionId
'authManager'=>array( 
                        'class'=>'RightsAuthManager',
                        'connectionID'=>'db',
                ),

Thanks for the conversation,

Saiful
0

#72 User is offline   pingala 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 14-July 10
  • Location:Dublin, Ireland

Posted 30 August 2010 - 11:47 AM

View Postsaiful, on 30 August 2010 - 10:33 AM, said:

@pingala
try to add connectionId
'authManager'=>array( 
                        'class'=>'RightsAuthManager',
                        'connectionID'=>'db',
                ),



cheers mate, actually that's not it but you reminded me to check the db settings and what I've found is that the user I've created on MySQL didn't have the privileges to create tables ... pity I didn't get any error message in regards I would have saved a lot of time.

So I would add in the documentation a note specifying that the db user must have privileges to create tables, as check point so the developer is forced to check :)

thanks.
0

#73 User is offline   Chris83 

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

Posted 30 August 2010 - 01:37 PM

View Postpingala, on 30 August 2010 - 11:47 AM, said:

cheers mate, actually that's not it but you reminded me to check the db settings and what I've found is that the user I've created on MySQL didn't have the privileges to create tables ... pity I didn't get any error message in regards I would have saved a lot of time.

So I would add in the documentation a note specifying that the db user must have privileges to create tables, as check point so the developer is forced to check :)

thanks.


Thanks for pointing this out. Sorry for the inconvenience, I will add this to the documentation. Weird that you didn't get any errors. I have to try denying the create privileges on one of my test installations and try to figure out why you didn't get any errors when trying to install the module.

So now you got it up and running? :)
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
0

#74 User is offline   angelus_ira 

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

Posted 04 September 2010 - 11:24 AM

I have one problen on a fresh install of yii (database of my own desing)
Whe i try to use the system on any controller i get this error:
Filter "rights" is invalid. Controller "PagesController" does have the filter method "filterrights".


To fix this i must modify the controller class from
class Controller extends CController

to
class Controller extends RightsBaseController


I am pretty new to yii so i must be making a mistake, if there are a better way please tell me. If this change is a must, then it should be good to add to the docs of yii-rights.
0

#75 User is offline   Chris83 

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

Posted 04 September 2010 - 01:32 PM

View Postangelus_ira, on 04 September 2010 - 11:24 AM, said:

I have one problen on a fresh install of yii (database of my own desing)
Whe i try to use the system on any controller i get this error:
Filter "rights" is invalid. Controller "PagesController" does have the filter method "filterrights".


To fix this i must modify the controller class from
class Controller extends CController

to
class Controller extends RightsBaseController


I am pretty new to yii so i must be making a mistake, if there are a better way please tell me. If this change is a must, then it should be good to add to the docs of yii-rights.


You're absolutely right and there is no other way to do it. It's mentioned in the documentation. This is because the filter method (RightsFilter) is in the RightsBaseController-class so you must extend you application base controller (normally Controller) from that class in order to use the rights ACAC filter.
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
0

#76 User is offline   angelus_ira 

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

Posted 04 September 2010 - 05:24 PM

I read the docs again and found it...

Quote

Automatic Controller Access Control (ACAC)
Rights allows for automatic controller access control by implementing an own filter. In order to use this filter you need to extend your application base controller (normally called Controller) from the RightsBaseController.


I was looking on all the examples and i must have pass that. Sorry for the question.

On the example blog we use the:
    /**
    * Returns a specific Rights configuration variable.
    * @param string the name of the variable to get.
    * @return mixed the value of the variable or null if not set.
    */
    public static function getConfig($name)
    {
        $module = self::module();
        if( isset($module->$name)===true )
            return $module->$name;
        else
            return null;
    }

This function do not exist anymore on the last revision, how can i check on a view if a user is the superuser:
(on the blog of rev 9.10 we use):
array('label'=>'Rights', 'url'=>array('/rights'), 'visible'=>Yii::app()->user->checkAccess(Rights::getConfig('superuserRole'))),

thanks for the previus reply and keep doing this amazing module

Edit:
Using
array('label'=>'Rights', 'url'=>array('/rights'), 'visible'=>Rights::getAuthorizer()->isSuperuser()),

instead of the previus way the system works ok. So do not reply my question

This post has been edited by angelus_ira: 04 September 2010 - 09:19 PM

0

#77 User is offline   Chris83 

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

Posted 05 September 2010 - 03:14 AM

@angelus_ira: The Rights::getConfig()-method was removed because you can achieve the same by calling e.g.

Rights::module()->superuserName.

It's alright to ask. I'm glad to answer any questions or explain why some things have been done in a certain way.
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
0

#78 User is offline   Chris83 

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

Posted 06 September 2010 - 01:51 AM

Version 0.9.11 is now available.

Rights has undergone a major user interface review and it should be more user-friendly now.

Important note:
Operations for the Automatic Controller Access Controller filter are now case-sensitive.

Read the updated documentation before you install. It can be found at:
http://yii-rights.go...-doc.0.9.11.pdf

Updating your current Rights-installation is easily done by re-installing.
Please remember that re-installing the module will result in loss of data.

The translations aren't complete at the moment because they haven't been updated.
I'll try to get them updated as soon as possible. Sorry for the inconvenience.


Enjoy!
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
0

#79 User is offline   joeysantiago 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 01-April 10

Posted 06 September 2010 - 02:18 AM

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
joey santiago

an Italian with Suomi inside.
0

#80 User is offline   Flinx 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 20-November 09
  • Location:Munich, Germany

Posted 06 September 2010 - 04:41 AM

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
0

Share this topic:


  • (32 Pages)
  • +
  • « First
  • 2
  • 3
  • 4
  • 5
  • 6
  • 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