[EXTENSION] srbac : Web interface for the administration of rbac

did you make the changes that I described ?

and also the one from Anticon:


$criteria->condition = "itemname = '".Yii::app()->getModule('srbac')->superUser."'";

With these changes, it works here

Yes I did, I also dumped $ex and that’s the Trace:

[html]

object(CDbException)#20 (6) {

["message:protected"]=>

string(142) “CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1005 Can’t create table ‘.\blog\itemchildren.frm’ (errno: 150)”

["string:private"]=>

string(0) ""

["code:protected"]=>

int(0)

["file:protected"]=>

string(86) "C:\Documents and Settings\Administrator\Apache2\htdocs\yii\framework\db\CDbCommand.php"

["line:protected"]=>

int(215)

["trace:private"]=>

array(11) {

[0]=>


array(6) {


  ["file"]=>


  string(105) "C:\Documents and Settings\Administrator\Apache2\htdocs\blog\protected\modules\srbac\components\Helper.php"


  ["line"]=>


  int(244)


  ["function"]=>


  string(7) "execute"


  ["class"]=>


  string(10) "CDbCommand"


  ["type"]=>


  string(2) "->"


  ["args"]=>


  array(0) {


  }


}


[1]=>


array(6) {


  ["file"]=>


  string(105) "C:\Documents and Settings\Administrator\Apache2\htdocs\blog\protected\modules\srbac\components\Helper.php"


  ["line"]=>


  int(205)


  ["function"]=>


  string(<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' /> &quot;_install&quot;


  [&quot;class&quot;]=&gt;


  string(6) &quot;Helper&quot;


  [&quot;type&quot;]=&gt;


  string(2) &quot;::&quot;


  [&quot;args&quot;]=&gt;


  array(1) {


    [0]=&gt;


    &amp;string(1) &quot;1&quot;


  }


}


[2]=&gt;


array(6) {


  [&quot;file&quot;]=&gt;


  string(118) &quot;C:&#092;Documents and Settings&#092;Administrator&#092;Apache2&#092;htdocs&#092;blog&#092;protected&#092;modules&#092;srbac&#092;controllers&#092;AuthItemController.php&quot;


  [&quot;line&quot;]=&gt;


  int(423)


  [&quot;function&quot;]=&gt;


  string(7) &quot;install&quot;


  [&quot;class&quot;]=&gt;


  string(6) &quot;Helper&quot;


  [&quot;type&quot;]=&gt;


  string(2) &quot;::&quot;


  [&quot;args&quot;]=&gt;


  array(2) {


    [0]=&gt;


    &amp;string(9) &quot;Overwrite&quot;


    [1]=&gt;


    &amp;string(1) &quot;1&quot;


  }


}


[3]=&gt;


array(6) {


  [&quot;file&quot;]=&gt;


  string(98) &quot;C:&#092;Documents and Settings&#092;Administrator&#092;Apache2&#092;htdocs&#092;yii&#092;framework&#092;web&#092;actions&#092;CInlineAction.php&quot;


  [&quot;line&quot;]=&gt;


  int(32)


  [&quot;function&quot;]=&gt;


  string(13) &quot;actionInstall&quot;


  [&quot;class&quot;]=&gt;


  string(18) &quot;AuthItemController&quot;


  [&quot;type&quot;]=&gt;


  string(2) &quot;-&gt;&quot;


  [&quot;args&quot;]=&gt;


  array(0) {


  }


}

[/html]

Any Clue? If u need the full trace just tell me. Thank you

Hi, I just returned from vacations and i try to look into these problems.

The undefined variables errors were in the early alpha version of srbac.In the beta versions they are fixed . If you still find any undefined vars let me know

sebi which version of srbac are you using?

And with witch database? I tried sqlite and mySQL with no problems

Edited:

I guess you are using InnoDB as the mySQL engine

Try with MyIsam and let me know if you have any problems while i’ll look into the innoDB problem

New Edit :

OK it’s fixed (that was fast :) )

srbac beta 4 is online

with the following fixes:

Fixed bug when when a not-Authorizer-user tries to access SRBAC (thanks to Anticon)

Fixed bug with deleting tables in wrong order (thanks to rabol)

Fixed bug with wrong column name resulting in errors while working with innoDB engine(thanks to sebi)

You are to fast, at the moment I can only use innoDB engine.

Iv’e installed it now and it seems to be work, still 1 undefined var error:

[html]

PHP Error

Description

Undefined variable: message

Source File

C:\Documents and Settings\Administrator\Apache2\htdocs\blog\protected\modules\srbac\controllers\AuthItemController.php(145)

00133: $this->_setMessage($this->module->tr->translate(‘srbac’,‘Task(s) Revoked’));

00134: }else if($assignOpers && is_array($authItemAssignName)) {

00135: $this->_assignChild($assItemName,$authItemAssignName);

00136: $this->_setMessage($this->module->tr->translate(‘srbac’,‘Operation(s) Assigned’));

00137: } else if($revokeOpers && is_array($authItemRevokeName)) {

00138: $this->_revokeChild($assItemName,$authItemRevokeName);

00139: $this->_setMessage( $this->module->tr->translate(‘srbac’,‘Operation(s) Revoked’));

00140: }

00141: //If not ajax show the assign page

00142: if(!Yii::app()->request->isAjaxRequest) {

00143: $this->render(‘assign’,array(

00144: ‘model’=>$model,

00145: ‘message’=>$message,

00146: ‘userid’=>$userid,

00147: ‘active’=>$active,

00148: ‘data’=>$data,

00149: ));

00150: } else {

00151: // assign to user show the user tab

00152: if($userid != "") {

00153: $this->_getTheRoles();

00154: }

00155: else if($assignTasks != 0 || $revokeTasks != 0) {

00156: $this->_getTheTasks();

00157: }

[/html]

thanks for the quick fix ;)

sebi

Ok another Problem that I’ve found, after changing to E_NOTICE to install srbac without a fix ;)

I got the Problem that the Roles are assigned and unassigned by every user.

Please see the Image attached, I will try to find a solution tomorrow, if u aren’t faster;)

Regards & Good Night,

Sebi

This was fixed at beta1 version

I just test the latest release with a MySQL InnoDB database without having this problem

Hi Spyros,

I’ve installed beta4 and found a small bug in “userAssignments.php”, take a look at the attachment.

Greetings

Carsten

EDIT: I have found another point:


  public function actionAutocomplete() {

    $criteria = new CDbCriteria();

    $criteria->condition = "name LIKE '%".Yii::app()->request->getParam('q')."%'";

...



I remember, that this could be a security problem (SQL-injections) and it is recommended to use params:


    $criteria = new CDbCriteria();

    $criteria->condition = "name LIKE :name";

    $criteria->params = array(":name"=>"%".Yii::app()->request->getParam('q')."%");



See also:link

fixed problems shouldn’t be there ^^

I will try to rebuild the issue and fix it myself.

gl

About the first problem , i think you are using an older css file. Delete the srbac folder of your asset directory so the new css will be published again

About the second problem you are right, I will change it

You are right, after the deletion of the files in assets it works properly. Thanks. :)

Hi spyros

after clicking Install button tables are created. then administrator is saved in that page after i gave index.php?r=srbac/authItem/assign in the address bar after my address it gives

YiiBase::include(User.php) yiibase.include: failed to open stream: No such file or directory why this appears?

why

Hi spyros

after clicking Install button tables are created. then administrator is saved in that page after i gave index.php?r=srbac/authItem/assign in the address bar after my address it gives YiiBase::include(User.php) yiibase.include: failed to open stream: No such file or directory why this appears?

my srbac configuration is

<?php

return array(

'basePath'=&gt;dirname(__FILE__).DIRECTORY_SEPARATOR.'..',


'name'=&gt;'',


'defaultController'=&gt;'login',





'preload'=&gt;array('log'),








'import'=&gt;array(


	'application.models.*',


	'application.components.*',


	'application.extensions.*',


	'application.controllers.*',

),

‘modules’=>array(‘srbac’=>

array(

// Your application’s user class (default: User)

"userclass"=>"User",

// Your users’ table user_id column (default: userid)

"userid"=>"user_ID",

// your users’ table username column (default: username)

"username"=>"username",

// If in debug mode (default: false)

// In debug mode every user (even guest) can admin srbac, also

//if you use internationalization untranslated words/phrases

//will be marked with a red star

"debug"=>false,

// The number of items shown in each page (default:15)

"pageSize"=>10,

// The name of the super user

"superUser" =>"Authority",

)),

'components'=&gt;array(

‘authManager’=>array(

// The type of Manager (Database)

‘class’=>‘CDbAuthManager’,

// The database connection used

‘connectionID’=>‘db’,

// The itemTable name (default:authitem)

‘itemTable’=>‘items’,

// The assignmentTable name (default:authassignment)

‘assignmentTable’=>‘assignments’,

// The itemChildTable name (default:authitemchild)

‘itemChildTable’=>‘itemchildren’,

),

‘mailer’ => array(

  'class' =&gt; 'application.extensions.mailer.EMailer',


  'pathViews' =&gt; 'application.views.email',


  'pathLayouts' =&gt; 'application.views.email.layouts'

),

	'log'=&gt;array(


		'class'=&gt;'CLogRouter',


		'routes'=&gt;array(

array(

				'class'=&gt;'CFileLogRoute',


				'levels'=&gt;'error, warning',

),

),

),

 'db'=&gt;array( 





         'class'=&gt;'system.db.CDbConnection',


		'connectionString'=&gt;'mysql:host=localhost;dbname=eprodigy',


		'username'=&gt;'root',


		'password'=&gt;'password',

),

	'user'=&gt;array(

// enable cookie-based authentication

		'allowAutoLogin'=&gt;true,

),

),

'params'=&gt;array(





	'adminEmail'=&gt;'webmaster@example.com',

),

);

Do you have the User class (with user_ID, and username attributes) in your application?

I created a file as User.php and stored in models

class User

{

public &#036;userid;


public &#036;username;

}

onclick assignitem link it gives following error

Fatal error: Call to undefined method User::findAll() in /var/www/code/php/protected/modules/srbac/views/authItem/tabViews/roleToUser.php on line 23

why

Your Users class should extend ActiveRecord

Check here how to create a model / controller /view

http://www.yiiframework.com/doc/blog/prototype.scaffold

I created User class that extends CActiveRecord and stored in models in srbac

class User

{

public &#036;userid;


public &#036;username;


public static function model(&#036;className=__CLASS__)


{


	return parent::model(&#036;className);


}

}

but it needs User table

can i must create User table

if i need then what is the structure of User table

still it gives an error when i click assign item link

Fatal error: Call to undefined method User::findAll() in /var/www/code/php/protected/modules/srbac/views/authItem/tabViews/roleToUser.php on line 23

can i customize srbac for my requirements

types of users

student,staff,parents,administrative staff,super user with permissions

how

You should create a table in your database

eg user with columns user_ID, username, password

then in the command prompt type

/path/to/framework/yiic shell /path/to/application/index.php

and then

>> model User

to create the model for the user table

and

>> crud User

to create the crud operations (controller and views)

Thanks spyros

It works

what is the purpose of users,roles,tasks tabs

my project has various users such as student,staff, parents,administrative staff,super user

How to customize your creation into my user types student,staff, parents,administrative staff,super user with permissions to visit particular pages

only Super user or administrative staff can create other user types with password for login our project so how to customize yours

First create the operations/roles in the /index.php?r=srbac/authItem/manage/manage page and then assign them to your users