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

Report a bug:

Missing argument 2 for Helper::findInModule(), called in D:\htdocs\yiiapp\backend\protected\modules\srbac\components\Helper.php on line 370 and defined

Please replace line 370 of Helper.php

return self::findInModule("srbac")->tr->translate($source,$text,$lang);

with

return self::findModule("srbac")->tr->translate($source,$text,$lang);

and see if it works

Ok great, thanks!

However, I get a similar error: ‘Trying to get property of non-object’.

line 370 helper.php:


return Yii::app()->getModule("srbac")->tr->translate($source,$text,$lang);

I have srbac nested as a child module.

Look at answer 302

Hey thanks, yeah sorry I was only looking at “getModule” didn’t see return self.

I’m still getting a couple of errors though… not sure if anyone else is?




Fatal error: Call to a member function getAlwaysAllowed() on a non-object in /Library/WebServer/Documents/mysite/protected/modules/admin/modules/srbac/controllers/SBaseController.php on line 65

I get this error when I try to scan controller actions and when I try to edit always allowed list. I have ‘alwaysAllowed’=>‘gui’ in my config.

Also, I am unable to view the ‘assign to user’ page and get the following error when I visit admin/srbac/authitem/assign




Object of class AdminModule could not be converted to string - operationToTask.php(71)


00071: $parent = $this->module->parentModule ? $this->module->parentModule."/" : "" ;



If you know of a fix would be great. And thanks heaps for your help so far!

Also, should ‘Autocreate Auth Items’ show child module controllers? As Srbac doesn’t show up under this options as a child module.

Line 71 should be

$parent = $this->module->parentModule ? $this->module->parentModule->name."/" : "" ;

It’s was fixed in SVN a couple of days ago.

Which version of srbac are you using?

The always allowed error is found and fixed

I’ll install srbac as child module and check the other problems

Yes I didn’t have the latest version so now it is working fine. Thanks

Also, should ‘Autocreate Auth Items’ show child module controllers? As Srbac doesn’t show up under this option as a child module.

If you could let me know would be great!

Currently autocreating for submodules is not supported.

Only autocreating for controllers in subdirectories.

It seems I missed that. I’ll try to add it in the next update.

(Anyway if only srbac is used as a child module autocrating for srbac Controller is not needed as only Authority role has access to it)

hey,dear spyros,good job.

but i have a question.

i use yii1.1 and srbac 1.1,when i installed finished,i open http://localhost/srbac/authitem/frontpage

,it will guide me to http://localhost/srbac/authitem/install

and i can only install,and install again…

what’s the problem? is i finished yet??

thank you

I have installed srbac 1.1 ,however, it reports : There is an error in your configuration

but I can not find out where is the wrong or missing config, it would be better to point which configuration item is wrong .

another question:

Did I need to establish 3 following tables firstly for AuthManager:

items, assignments, itemchildren

which colums are required by these tables then?

looking forward your kindly answer,

thank you,

What database are you using?

Are the auth tables created?

is http://localhost/srbac/authitem/manage working?

The database tables are created by srbac.You don’t have to create them.

When in install page are any srbac attributes painted red instead of black or green?

Could you paste here your srbac configuration?

em,I am meeting the same problem as you.

your demo url can’t be reached now ,can it?

no ,when i visit http://localhost/srbac/authitem/manage,it will turn to install page.

well,i guess i will happen when it’s a new fresh installation of yii.

1,first create webapp

2,create user table,and use "yiic shell" to "model user,crud user"…

3,unzip srbac to webapp’s module folder.

4,in config/main.php write the things.

5,open the url http://localhost/srbac, and install…

6,it mentions succesfully ,and I open http://localhost/srbac/manage,it will redirect to http://localhost/srbac/install again.

the main.php is:


'modules'=>array(

		'srbac'=>

			array(

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

			"userclass"=>"user",

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

			"userid"=>"userid",

			// 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"=>true,

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

			"pageSize"=>16,

			// The name of the super user

			"superUser" =>"Authority",

			//The css file to use

			//"css"=>"srbac_red.css", // must be in srbac css folder

			//The layout to use

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

			//The not authorized page

			"notAuthorizedView"=>"application.views.site.login",

			// The always allowed actions

			"alwaysAllowed"=>array(

				'SiteLogin','SiteLogout','SiteIndex','SiteAdmin',

				'SiteError', 'SiteContact','SiteCaptcha'

			),

			// The operationa assigned to users

			"userActions"=>array(

				"Show","View","List"

			),

			// The number of lines of the listboxes

			"listBoxNumberOfLines" => 10,

			// The path to the custom images relative to basePath (default the srbac images path)

			//"imagesPath"=>"../images",

			//The icons pack to use (noia, tango)

			"imagesPack"=>"tango",

			// Whether to show text next to the menu icons (default false)

			"iconText"=>true,

		)

	),



and the auth section is:



[quote]
'authManager'=>array(

			// The type of Manager (Database)

			'class'=>'CDbAuthManager',

			// The database connection used

			'connectionID'=>'db',

			// The itemTable name (default:authitem)

			'itemTable'=>'AuthItem',

			// The assignmentTable name (default:authassignment)

			'assignmentTable'=>'AuthAssignment',

			// The itemChildTable name (default:authitemchild)

			'itemChildTable'=>'AuthItemChild',

		),
[/quote]


the installation info as following:

Your Database, AuthManager and srbac settings: 1.1

Database

Driver mysql

Connection mysql:host=127.0.0.1;dbname=rbac

AuthManager

Item Table AuthItem

Assignment Table AuthAssignment

Item child table AuthItemChild

srbac

yiiSupportedVersion

1.1.0

version

1.1.0 beta

debug

1

pageSize

16

alwaysAllowed

SiteLogin, SiteLogout, SiteIndex, SiteAdmin, SiteError, SiteContact, SiteCaptcha

userActions

Show, View, List

listBoxNumberOfLines

10

iconText

1

showHeader

showFooter

useAlwaysAllowedGui

userid

userid

username

username

userclass

user

superUser

Authority

css

srbac.css

notAuthorizedView

application.views.site.login

layout

application.views.layouts.main

imagesPath

srbac.images

imagesPack

tango

header

srbac.views.authitem.header

footer

srbac.views.authitem.footer

Yii

Yii version : 1.1b

Create demo authItems?

yep. and hope spyros can fix it…thank you spyros

I found in srbac :

models are all classes extends CActiveRecord,and the names exactly are:

Assignments, AuthItem and ItemChildren.

they are different from the configuration’s default,maybe it cause some wrong?

well, there isn’t any red attributes in the install list, I snapped it as attachments,and the exactly configuration is :

‘modules’=>array(

	'srbac' => array( 


		 'userclass'=>'User', 


		 'userid'=>'id', 


		 'username'=>'username', 


		 'debug'=>true, 


		 'pageSize'=>10, 


		 'superUser' =>'Authority', 


		 'css'=>'srbac_red.css',  


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


		 'notAuthorizedView'=>'application.views.site.unauthorized', 


		 'alwaysAllowed'=>array( 


			'SiteLogin','SiteLogout','SiteIndex','SiteAdmin','SiteError','SiteContact'), 


		 'userActions'=>array( 


			'Show','View','List'), 


		 'listBoxNumberOfLines' => 15, 


		 'useAlwaysAllowedGui'=>true,


		 'imagesPath' =>"http://localhost/Belief/protected/modules/srbac/images", 


		 'imagesPack'=>'noia', 


		 'iconText'=>true, 


		 'header'=>'application.views.header', 


		 'footer'=>'application.views.footer', 


		 'showHeader'=>true, 


		 'showFooter'=>true, 


	   ), 


  ),

			//authManager


			'authManager'=>array( 


				// The type of Manager (Database) 


				'class'=>'CDbAuthManager', 


				// The database component used 


				'connectionID'=>'db', 


				// The itemTable name (default:authitem) 


				'itemTable'=>'authitem', 


				// The assignmentTable name (default:authassignment) 


				'assignmentTable'=>'assignments', 


				// The itemChildTable name (default:authitemchild) 


				'itemChildTable'=>'itemchildren', 


			 ),

and mysql works well:

			'db'=>array(					


				'class'=>'CDbConnection',


				'connectionString'=>'mysql:host=localhost;dbname=testdb',


				'username'=>'sys2009',


				'password'=>'mypwd',		


				'charset'=>'utf8',			


			),

//authManager

‘authManager’=>array(

// The type of Manager (Database)

‘class’=>‘CDbAuthManager’,

// The database component used

‘connectionID’=>‘db’,

// The itemTable name (default:authitem)

‘itemTable’=>‘authitem’,

// The assignmentTable name (default:authassignment)

‘assignmentTable’=>‘assignments’,

// The itemChildTable name (default:authitemchild)

‘itemChildTable’=>‘itemchildren’,

),

change Authitem to authitem

change Assignments to assignments

change Itemchildren to itemchildren

and it works .wow.~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hi Spyros,

Just wondering if you can clarify a couple of things for me. How does alwaysAllowed GUI interface work? I noticed there is an empty array in allowed.php under components directory.

At the moment when I press save nothing is actually saved. Do I need to add controller actions to allowed.php array?

Also, in config file what does the ‘userActions’=>array(‘Show’,‘View’,‘List’) specify?

Look forward to your reply… thanks :huh: