gRbac - User registration, authentication and management

Hi Pradhan,

New to yii…

I will be trying this ext out. Great work

Seal

Hi

I get problem with the hash function using sha256 .

Login fails with this problem.

The encrypted value for the password entered in login form differs from the one that actually stored in the db.

I am using salt exactly u did.

I have been working on this for several hours, but n vain.

Hope you suggest a solution

Thanks

Chandu

Check the length of the encrypted string length and the varchar(NN) of the column password in user table. I have not been able to upgrade fro alpha release yet due to problem with my computer.

Is this extension suitable for use with Yii 1.1.0?

Yes final and minimal testing was done in Yii 1.1

Hi Chandu,

I have the same problem. Did you find a solution?

I find that whenever I login - It throws an exception "Users.salt" is not defined

Has anyone experienced this?

Any hints please?

Thanks

I’m having the 403 problem with the login page, as a previous poster did. Unfortunately, adding the ‘alwaysAllowed’ entry in the srbac config didn’t help. The error message I’m getting is:




Error:403 'You are not authorized for this action'

Error while trying to access grbac/authenticate/login.



I also tried putting the print_r statement in the Users::authenticateLogin() method in grbac, but nothing printed out. I don’t think its getting executed at all. Here’s the relevant portion of my config:




                         'grbac' => array(

                                          'defaultRole'        => 'User',

                                          'hashAlgo'           => 'sha256',

                                          'enableRegistration' => true,

                                          'enableRemember'     => true,

                                          'durationRemember'   => 30,

                                          'emailConfirmation'  => true,

                                          'emailFrom'          => '...',

                                          ),

                         'srbac' => array(

                                          'userclass'            => 'Users',

                                          'userid'               => 'id',

                                          'username'             => 'username',

                                          'debug'                => true,

                                          'pageSize'             => 10,

                                          'superUser'            => 'Authority',

                                          'css'                  => 'srbac.css',

                                          'layout'               => 'application.views.layouts.main',

                                          'alwaysAllowed'        => array( 'grbacAuthenticateLogin' ),

                                          'notAuthorizedView'    => 'srbac.views.authitem.unauthorized',

                                          'userActions'          => array( 'Show', 'View', 'List' ),

                                          'listBoxNumberOfLines' => 15,

                                          'imagesPath'           => 'srbac.images',

                                          'imagesPack'           => 'noia',

                                          'iconText'             => true,

                                          'header'               => 'srbac.views.authitem.header',

                                          //'footer'             => 'srbac.views.authItem.footer',                                                                                 

                                          'showHeader'           => true,

                                          'showFooter'           => true,

                                          'alwaysAllowedPath'    => 'srbac.components',

                                          )



I think the problem may be in my database setup. Here are the rows from the relevant tables:




authentr_pantry=> select * from authassignment;

 itemname  | userid | bizrule |  data

-----------+--------+---------+---------

 Authority | 1      |         | s:0:"";

 User      | 2      |         | s:0:"";

(2 rows)


authentr_pantry=> select * from authitemchild;

 parent | child

--------+-------

(0 rows)


authentr_pantry=> select * from authitem;

   name    | type | description | bizrule | data

-----------+------+-------------+---------+------

 Authority |    2 |             |         |

 User      |    2 |             |         |

(2 rows)



Any help would be appreciated!

I will try with newer release of SRBAC and make the updates.

I tried this today with SRBAC 1.1.0, it is working with me.

Did you create the user table?

Yes, here it is:




authentr_pantry=> select id,username,password from users;

 id | username |             password

----+----------+----------------------------------

  1 | admin    | 21232f297a57a5a743894a0e4a801fc3

  2 | test1    | 21232f297a57a5a743894a0e4a801fc3

(2 rows)



Hi, I’m trying to configure grbac. I’ve done all steps from manual, srbac works, but when i try to use grbac i’m getting error: [i]Error 500

Property "RegistrationController.breadcrumbs" is not defined.[/i].

Please help.

thank you.

Is there any way that you could quickly clean up the documentation for gRBAC. The are multiple places where there are ‘install’ docs but none seem to be complete.

The doc found here: http://gemisoft.com/site/grbac.html

Doesn’t tell you any part of the installation but talks about the BaseController. I think you need to show the complete code for the BaseController and also a link to where it should be in your site (ie: /protected/controllers/BaseController.php) As a developer, I know that certain things should be obvious to your users but sometimes they are not.

OK… all that aside. I have gone through all of the documentation but still cannot get gRBAC working. I can’t even get it to come up on my site. I have sRBAC working properly but for some reason when I visit any grbac link (ie: www.example.com/grbac/authenticate/login) I get a 404 error with: Unable to resolve the request “grbac/authenticate/login”.

My main.php sections for grbac looks like this:




        'import'=>array(

                'application.modules.grbac.models.Users',

        .....


        'modules'=>array(

                'grbac'=>array(

                        'defaultRole'        => 'User',

                        'hashAlgo'           => 'sha256',

                        'enableRegistration' => true,

                        'enableRemember'     => true,

                        'durationRemember'   => 30,

                        'emailConfirmation'  => true,

                        'emailFrom'          => '**********@********.com',

                ),



I am using yii v1.1.2 and I unpacked the module’s zip into the protected/modules directory.

I would love to get grbac working as the code seems to be clean and work well with srbac. If there is anything you can do to help me out please let me know!

Hello.

Trying to install gRbac.

After configuration and installation, I try to access localhost/robots/index.php?r=grbac/authenticate/login I get this:




CException


Description


Property "Users.allowAutoLogin" is not defined.


Source File


/Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/db/ar/CActiveRecord.php(123)


00111:      * PHP setter magic method.

00112:      * This method is overridden so that AR attributes can be accessed like properties.

00113:      * @param string property name

00114:      * @param mixed property value

00115:      */

00116:     public function __set($name,$value)

00117:     {

00118:         if($this->setAttribute($name,$value)===false)

00119:         {

00120:             if(isset($this->getMetaData()->relations[$name]))

00121:                 $this->_related[$name]=$value;

00122:             else

00123:                 parent::__set($name,$value);

00124:         }

00125:     }

00126: 

00127:     /**

00128:      * Checks if a property value is null.

00129:      * This method overrides the parent implementation by checking

00130:      * if the named attribute is null or not.

00131:      * @param string the property name or the event name

00132:      * @return boolean whether the property value is null

00133:      * @since 1.0.1

00134:      */

00135:     public function __isset($name)

Stack Trace


#0 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/db/ar/CActiveRecord.php(123): CComponent->__set('allowAutoLogin', true)

#1 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/YiiBase.php(208): CActiveRecord->__set('allowAutoLogin', true)

#2 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/base/CModule.php(362): YiiBase::createComponent(Array)

#3 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/base/CModule.php(86): CModule->getComponent('user')

#4 /Applications/xampp/xamppfiles/htdocs/robots/protected/views/layouts/main.php(34): CModule->__get('user')

#5 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/web/CBaseController.php(119): require('/Applications/x...')

#6 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/web/CBaseController.php(88): CBaseController->renderInternal('/Applications/x...', Array, true)

#7 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/web/CController.php(689): CBaseController->renderFile('/Applications/x...', Array, true)

#8 /Applications/xampp/xamppfiles/htdocs/robots/protected/modules/grbac/controllers/AuthenticateController.php(35): CController->render('login', Array)

#9 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/web/actions/CInlineAction.php(32): AuthenticateController->actionLogin()

#10 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/web/CController.php(300): CInlineAction->run()

#11 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/web/CController.php(278): CController->runAction(Object(CInlineAction))

#12 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/web/CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)

#13 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/web/CWebApplication.php(320): CController->run('login')

#14 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/web/CWebApplication.php(120): CWebApplication->runController('grbac/authentic...')

#15 /Applications/xampp/xamppfiles/htdocs/yii-1.1.2/framework/base/CApplication.php(135): CWebApplication->processRequest()

#16 /Applications/xampp/xamppfiles/htdocs/robots/index.php(12): CApplication->run()

#17 {main}



Users.allowAutoLogin? why?

Using Yii 1.1.2

gRbac config:




		'grbac'=>array(

			'defaultRole'=>'User',

			'hashAlgo'=>'sha256',

			'enableRegistration'=>true,

			'enableRemember'=>true,

			'durationRemember'=>7,

			'emailConfirmation'=>true,

			'emailFrom'=>'---@---.---',

		),



Thank you.

I try to release the new code in few days.

autoLogin Final done with short registration form.

In this release only 3 controller are worked out.

Hi, I’m really new to Yii. I’ve been trying to determine how to configure gRbac, but am quite lost at the moment. Since there is not a single document that describes how to configure it, I’ve been trying to piece together what’s in the various tabs at http://gemisoft.com/site/grbac.html. I have several questions:

  1. Overview tab: It appears by the paths listed that the modules folder containing both srbac and grbac is under the components folder rather than at the same folder level, is that correct?

i.e.


application.components.modules.srbac.SBaseController

  1. Following up on the example path above (still on Overview tab), I have no idea what the srbac’s SBaseController file should look like unless the entirety of it is exactly what’s shown (though it doesn’t look correct to me). Or is this to be saved into a different file, such as the srbac.components.allowed(.php) file? What am I missing here????

My SRBAC's allow list looks like this! <?

 return array(

    'grbac/AuthenticateLogin',

    'grbac/AuthenticateLogout',

    'grbac/PasswordCaptcha',

    'grbac/PasswordForgot',

    'grbac/PasswordValidate',

    'grbac/PasswordPassword_reset',

    'grbac/RegistrationCaptcha',

    'grbac/RegistrationRegister',

    'grbac/RegistrationValidate'

);

 ?> 

  1. Overview tab: Is this path correct?

application.components.modules.grbac.GrbacController extend SBaseController

or should it be


application.components.modules.grbac.controllers.GrbacController extend SBaseController

  1. Configuration tab: Where should the code following ‘Forcing 401 for non Admin users’ be placed?

Sorry for asking so many questions. This is just not clear enough for new user to follow.

Thanks,

Henry

Ok, I think that I have been able to answer my own questions by playing around with files/paths.

After getting past this, I keep running into item after item that give me errors: noMetaCache, metaRobots, etc.

Would there be any way to get a sample application (say with one class, such as “Post”) with this (grbac/srbac) all configured and working (with 1.1.2, if possible) that I could download, install and then work through to see how it actually works instead of learning through the resolution of errors? That would be greatly appreciated, I’m sure by others beside myself.

Add these lines in your components.Controller

public &#036;metaDescription = null; //Default Meta Description


public &#036;metaKeywords    = null; //Default Meta Keywords


public &#036;metaRobots      = &quot;index, follow, NoArchive, NoImageIndex&quot;; //Default


public &#036;metaNoCache     = false;//Default

Hi Henry,

Thanks for point out my mistake.

Wrong: application.components.modules.srbac.SBaseController

Right: application.modules.srbac.SBaseController

I will fix it as soon.