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

The multiple submits seemed that were caused by the $live = true parameter in CHtml::clientChange called by the ajaxsubmitbutton, I overidden it in SHtml and it seemed to work now. Please check the code from svn

I also fixed this in svn, please take a look

Hi Spyros,

Thanks for the fixes. I checked the most recent version (v214) from SVN. It’s almost working. The bug which was duplicate-creating AuthItems is fixed. The bug of not serializing the [data] field is fixed. But there is one more issue related to serializing:

To recreate the new bug:

  1. Press the Gear icon

  2. press "create" button in left panel

  3. enter name "Test1", select type "Role"

  4. press “create” button in right panel. Get flash message ‘test1 created successfully’

[data] field is still blank - good

  1. on the "test1" item, enter "somedata" in [data] field, and press "save"

now [data] field shows [s:8:"somedata":], which is the serialized version. this is the error

you can update the field by replacing the entire contents, but each time Save is pressed, the serialized version is display.

This is a really great tool - thanks for creating and maintaining it, and for responding to all the requests for new features and fixes.

[font="Arial"][font="Verdana"]Thanks,

I have fixed it in svn

There’s still a problem with the autocomplete textfield that sends some dozens of queries each time so I will upgrade to Yii 1.1.3 and use the [/font][font=“Verdana”]CJuiAutocomplete instead , then I will release the new fixed version.

If there are still some problems let me know[/font]

[/font]

Hi, the SVN version doesn’t support actions anymore. At least not if these actions are in a subdir, like this:


Controller:

/controllers/admin/ReportController.php

actions in:

/controller/admin/report/TurnoverAction.php

Autocreate will give a 500 error in the Ajax call for the controller.

Thanks, the problem of serialized data showing is fixed in v215 from SVN.

Hello,

Is there any option to load User.php class from another location (like a user module)?

For now I added in my copy of SRBAC,

>config/main.php




  'userclassPath' => 'modules.hr.models.User'



and in

>SrbacModule.php




  public $userclassPath = '';


  public function getUserModel() {

    if(!empty($this->userclassPath)){

      include_once Yii::app()->basePath.DIRECTORY_SEPARATOR.str_replace('.', DIRECTORY_SEPARATOR, $this->userclassPath).'.php';

    }

    return new $this->userclass;

}



Thx, and keep up with the good job!

Let’s say your user model is in module:usersmodule

You have to import it in main.php config file




<?php

// autoloading model and component classes

    'import'=>array(

        'application.modules.usersmodule.models.User',

        ),

?>



and add it in srbac config




<?php 

'userclass'=>'User',

?>



That was fast reply, and solved the problem, thx again.

Small issue,

If I have an action like this:


public function actionAdmin($mParams = ''){}

Auto Create Auth Items try to build:


hr_UserAdmin$mParams=''

and fails, because of quotes.

I add them by hand now.

Hi, I’ve started looking at srbac and it looks great. I think I’ve got it mostly working but have a question:

  • The standard yii controller base class (Controller.php) has menu, layout and breadcrumb properties. I can only find breadcrumb properties in the AuthitemController. Is AuthitemController the correct base class to use in order to get automatic auth or is there another base class that implements the menu and layout properties? I’m sure there’s a good reason but it seems odd that SBaseController didn’t just inherit from Controller.php in the first place to retain the standard properties.

Thanks in advance,

Paul.

Hi all,

Working my way through a few experiments with Yii. Got Yii-User installed… now working on srbac.

Have this error on the Installation Check page:

[b]srbac is not Configured

Property "SrbacModule.relations" is not defined.[/b]

Not sure what the relations are the error refers to… wondered if it was 'cos I’m using Yii-User module as the user class?

part of import array…




'application.modules.srbac.controllers.SBaseController',

'application.modules.user.models.User',



part of modules array…




'srbac' => array(

'userclass'=>'User', //default: User

'userid'=>'id', //default: userid

'username'=>'username', //default:username



EDIT

If I comment out the following (line 76 of protected\modules\user\models\User.php)


if (Yii::app()->controller->module->relations) array_merge($relations,Yii::app()->controller->module->relations);

In the Yii-User module it works! Still learning this stuff… is this attemping to merge all the model relations into one array?

Description

CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘yii.assignments’ doesn’t exist

I get this error when i’m trying to run the installation page. Does this mean I have to create tables for rbac manually? If so, where can I find the description for the structure?


UPDATE:


Resolved the problem, found the DB schema under /framework/web/auth/schema.sql

hey, guys!

could you please tell me if the following is possible by using bizrules, because i can’t figure out how to perform the task i want

User

userId

userName

userPassword

userLevel (1-site admin, 2-client admin, 3-common)

Company

companyId

companyName

User_Manage_Company

userId

companyId

Offer

offerId

offerDate

offerCompanyId

relations are

user -> company is many_many

company -> offer is has_many

Site admin should be able to manage, create and update/delete everything

Client Admin should be able to manage only those offers belonging to the companies their are allowed to manage

Common user should be able to change their profile

my main problem in here is the second statement:

"Client Admin should be able to manage only those offers belonging to the companies their are allowed to manage"

I know that in admin/index actions i’ll have to include some criteria to filter the data, but in create/update/delete actions, the system should check for the rule i told

could somebody please give me a hint?

thanks

:)

I’m having exactly same issue…I’d like some hints too.

Controller is not a Yii core class. It’s created by the yicc tool so we can’t depend that it will always be available.

The solution is to add the menu and layout properties in SBaseController

Hey you guys,

first of all, thank you - spyros - for the great extension!

I was looking for a way to use bizrules with my tasks and ended up trying different variations of "return 1==1", "return true" and so on about over an hour, until i figured out that i just had to add a semicolon at the end of it, like "return true;"

So i just wanted to add this to this thread and warn other newbs like me, maybe this is going to help someone else.

If you want to use bizrules with the extension be sure to add a semicolon at the end of your rule, unless you’re not planing to almost freak out like me ;)

over and out

Hi Spyros

Is the any configuration needed for SRBAC to work with the sub modules? I am using 1.1 and latest updates from SVN

The automatic creation of authitems doesn’t scans submodules yet.

You can create the auth items manual with the proper naming and it should work

Thanks a lot. I will do so. Keep up your good work :)

Hi, I may be wrong, but it seems that now some items are created with $id at the end.

My fix was to append this:

if (in_array(&#036;access.'&#036;id', &#036;this-&gt;allowedAccess())) {


  return true;


}

in the beforeAction.

Thanks for your excellent work!!