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

Hi,

i’ve noticed strange issue but maybe it’s only lack of my knowledge about rbac :wink:

srbac uses userid which is identifier of user.

My user model has:

id,

username,

password,

etc.

so i set up ‘userid’ => ‘id’ in my config.

in AuthAssignment i’ve got an entry:

itemname, userid, bizrule, data

Administrator, 1, , s:0:"";

and the user is:

id, username, …

1, Administrator

It works fine in srbac admin module, but access to all other controllers actions is denied. I can’t do nothing.

I found that in CDbAuthManager.php:89 $command->bindValue(’:userid’,$userId); - the $userId is NAME of the already logged user - Administrator in that case.

So does srbac userid should be the same as username?

Thanks Spyros for a great module :slight_smile:

[edit]

I will post Polish translation in few days.

[edit2 - almost solved]

The userId problem reason is in CUserIdentity.php:64 class. By default the Id of user is equal to it’s name:


public function getId()

	{

		return $this->username;

	}

In my extending class i had to overwrite it to return my model’s id.

hi,

just wanted to report an error I occurred while trying to run srbac:

when I set the:

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

array as in the srbac_guide_1.1.0.pdf I get an error saying that it cannot find the ‘srbac.views.authItem.footer’

which is strange because when I comment out the default value:

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

//‘footer’=> ‘srbac.views.authItem.footer’,

)

it then works, any idea why? I’m using yii1.1 and srbac1.1.0.1

It’s a typo in the guide , it should be srbac.views.authitem.footer (authitem instead of authItem).

Thanks




CException

Description


Property "AuthitemController.breadcrumbs" is not defined.

Source File


(..)\protected\views\layouts\main.php(45)


00044:     <?php $this->widget('zii.widgets.CBreadcrumbs', array(

00045: 'links'=>$this->breadcrumbs,

00046:     )); ?><!-- breadcrumbs -->



What’s up with this? Am I supposed to hack my main.php to not output breadcrumbs for srbac? I find no reference to breadcrumbs anywhere in srbac.

Which version of srbac do you use?

Breadcrumbs are supported in 1.1.0 (r162)

Check if AuthitemController has an attribute

public $breadcrumbs;

hello spyros:

when I use your srbac module for yii project ,I find the code:

Yii::app()->clientScript->registerScript("cb",$script,CClientScript::POS_READY);

in protected/modules/srbac/views/authitem/tabViews/operationToTask.php file

is not work well in some browser.(in ie8,firefox,chrome,opera is work well,but in SogouExplorer ,Maxthon ,360safe which are made in china can’t work well).

and when I change the function’s third parameter to CClient:: POS_HEAD,it can work well in all above browser.

wait for your reply.thanks .

when I first setup the srbac , I get the same error,at last ,I find it’s the Case sensitive problem.

I could have sworn I was using the r165 version, but I must have accidentally copied the wrong directory to my server. Thanks, Spyros, love the work you’re doing.

Spyros,

Thank you for your efforts on this extension.

I reported a defect through the submission, but apparently can not submit more than one as I now receive:

Forbidden

Your client does not have permission to get URL /p/srbac/issues/entry from this server.

Would you please also look at the following?

In IE8, Chrome FF3.5 on Vista the auto-complete in the manage view fails after three characters.

In IE8, Chrome FF3.5 on Vista clicking search or hitting enter does not return search results, but simply the full item list.

In IE8, Chrome FF3.5 on Vista choosing an item type from the dropdown does not filter the results (however if you click to a different page after selecting a type, the filter takes effect ‘most of the time’).

Thanks again,

Nate

Hi all,

The Captcha in Contact page didn’t show when SBaseController extended.

Can any one solve this problem?

Thanks,

Yes, I know that captcha an other actions defined in a controller’s actions function are now shown up.

I can’t find a function in CController to get these actions. This will be fixed probably in the next srbac version

I couldn’t reproduce these on my Vista machine.

Hi There

first thank you for this great extension.

I Just installed the Extension and hat a problem with the SiteCaptcha and the SitePage when I used the always allow gui. Those two don’t have a action function.

Here my solution:

I created the file srbac/components/allowed_manual.php




<?php

$arrAllowed = array(

	'SitePage',

	'SiteCaptcha'

);



Then I changed srbac/controllers/AuthitemController.php:992 so that it includes my php file and returns the result of array_merge.




fwrite($handle, "<?php \n include('allowed_manual.php'); \n return array_merge(\$arrAllowed, array(\n\t\t'".implode("',\n\t\t'", $allowed)."'\n\t)\n);\n?>");



now I can use the gui for always allow and add some manual entries.

Yes , this is the way I was going to fix this in the next release.

Now you must use the array returned fom the GUI or the allowed.php file

In the next varsion these two arrays will be merged so you can use the gui and also you can manually add some functions in the allowed.php

Here are additional debugging steps:

In the manage/list view, the autocomplete widget uses match case at line 61. In AuthItemController, the autocomplete function uses the parameter (now toLower) to add a like condition at line 572. In postgres at least, I believe ‘auth’ !like ‘Auth’, the db field needs to be cased to lower as well.

In AuthItemController, an exception is thrown at line 578 if there were no results to loop through and assign to $valuesArray. Should the variable be assigned outside the conditional loop, or check the variable is set before echoing the results?

In AuthItemController, an exception is thrown in the list action because, in postgres at least, the condition ‘1’ does not evaluate to a boolean at line 460. Either ‘1=1’ or ‘true’ are acceptable.

Also, let me know if I can provide additional context for issue 48 in your google code tracker.

Thank you,

Nate

A couple additional google searches reveal these are indeed DB issues. I do not know what your ‘official’ supported list is, but here are the details for postgresql.

Reference:

Boolean evaluation of 1 would have to be quoted as ‘1’ to be valid, unlike MySQL

http://www.postgresql.org/docs/8.3/static/datatype-boolean.html

LIKE is case-sensitivie (ILIKE or converting to lower is the alternative), unlike MySQL

http://www.postgresql.org/docs/8.3/static/functions-matching.html

Hello,

I think I’m having troubles installing srbac. I’m using Yii 1.1.0r1700 and srbac 1.1.0.1_r165.

When I point to srbac/install I’m getting the error:


CDbCommand failed to prepare the SQL statement: SQLSTATE[HY000]: General error: 1 no such table: items

which I think it means that the installer can’t create the items table (since it can’t find it). Any thoughts on why its happening ?

the directory where the config file points to the database file is writable,

the filename of the database is created but with a 0 size.

It could be a configuration problem. Could you paste your srbac config array here?

I think I’m running into a bug.

When I navigate to http://localhost/testdrive/index.php?r=srbac/authitem/manage, I get the following message:

However, I have my config set to gui - here’s a snippet:




 'modules'=>array(

                'srbac' => array(

                    'userclass'=>'User', //optional defaults to User

                    'userid'=>'user_oid', //optional defaults to userid

                    'username'=>'email', //optional defaults to username

                    'debug'=>true, //optional defaults to false

                    'pageSize'=>10, //optional defaults to 15

                    'superUser' =>'Authority', //optional defaults to Authorizer

                    'layout'=>'application.views.layouts.main', //optional defaults to empty string

                    // must be an existing alias

                    'alwaysAllowed'=>array( //optional defaults to gui

                        'gui'

                    ),

...



If I remove the ‘alwaysAllowed’ option from the configuration, I get this error:




Fatal error: Call to a member function getControllerPath() on a non-object in C:\xampplite\htdocs\agapeProject\app\protected\modules\srbac\controllers\AuthitemController.php on line 698



Any ideas?

Hi,

I think your config has to look like this…




...

                   'alwaysAllowed'=>'gui', //optional defaults to gui

...



If you whant to use the gui you have to remove the array part and set the value as string