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

===================

wow, My srbac is working now.

I have found out the source causing all of the matters:

  1. css should be corrected—then it can show you where is wrong in red:

  2. other configurations:

===============================

‘db’=>array(

				'class'=>'CDbConnection',<------shouldn't be changed


				'connectionString'=>'mysql:host=localhost;dbname=testdb',<------should be change according to yours


				'username'=>'sys2009',<------should be change according to yours


				'password'=>'mypwd',	<------should be change according to yours	


				'charset'=>'utf8',	<------should be change according to yours		


			),

=======================================================

			//authManager


			'authManager'=>array( 


				// The type of Manager (Database) 


				'class'=>'CDbAuthManager', <------shouldn't be changed


				// The database component used 


				'connectionID'=>'db', <------shouldn't be changed


				// The itemTable name (default:authitem) 


				'itemTable'=>'authitem', <------shouldn be corrected as this


				// The assignmentTable name (default:authassignment) 


				'assignmentTable'=>'assignments', <------shouldn be corrected as this


				// The itemChildTable name (default:authitemchild) 


				'itemChildTable'=>'itemchildren', <------shouldn be corrected as this				 ),


),

======================================

‘modules’=>array(

	'srbac' => array( 


		 'userclass'=>'User', <------should be change according to yours


		 'userid'=>'id', <------should be change according to yours


		 'username'=>'username', <------should be change according to yours


		 'debug'=>true, 


		 'pageSize'=>10, 


		 'superUser' =>'Authority', 


		 'css'=>'srbac.css', <<<------shouldn be corrected as this!!!!


		 'layout'=>'application.views.layouts.main', <------shouldn't be changed


           'notAuthorizedView'=>'application.views.site.login', <------shouldn't be changed			 


		 'alwaysAllowed'=>array( 				'SiteLogin','SiteLogout','SiteIndex','SiteAdmin','SiteError','SiteContact','SiteCaptcha'), 


		 'userActions'=>array( 


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


		 'listBoxNumberOfLines' => 15, 


		 'useAlwaysAllowedGui'=>true,<------shouldn't be changed			 


		 'imagesPath' =>"srbac.images", <------shouldn't be changed


		 'imagesPack'=>'tango', 


		 'iconText'=>true, 


		 'header'=>'srbac.views.authitem.header', <------shouldn't be changed


		 'footer'=>'srbac.views.authitem.footer', <------shouldn't be changed


		 'showHeader'=>true, 


		 'showFooter'=>true, 


	   ), 


	   'import'=>array( 


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

),

well ,I find out where the problem arises: ‘css’=>‘srbac.css’, <------here I am too strictly to follow the srbac_guide which was: ‘css’=>‘srbac_red.css’,

and I can find out which is red now

=================

the srbac_guide_1.1 should be corrected ,thank you.


hey ,guy : mine srbac is working now.

‘useAlwaysAllowedGui’=>true,<----

will let it work.


‘userActions’=>array(

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

you needn’t change it.

be careful with css:

following is mine config------------- srbac_guide can’t be use immediately

		 'debug'=&gt;true, 


		 'pageSize'=&gt;10, 


		 'superUser' =&gt;'Authority', 


		 'css'=&gt;'srbac.css',  


		 'layout'=&gt;'application.views.layouts.main', 


		 'notAuthorizedView'=&gt;'application.views.site.login', 


		 'alwaysAllowed'=&gt;array( 


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


		 'userActions'=&gt;array( 


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


		 'listBoxNumberOfLines' =&gt; 15, 


		 'useAlwaysAllowedGui'=&gt;true,


		 'imagesPath' =&gt;&quot;srbac.images&quot;, 


		 'imagesPack'=&gt;'tango', 


		 'iconText'=&gt;true, 


		 'header'=&gt;'srbac.views.authitem.header', 


		 'footer'=&gt;'srbac.views.authitem.footer', 


		 'showHeader'=&gt;true, 


		 'showFooter'=&gt;true, 

=======================

good lucky

========================

well, if you have installed demo, you’d better install it again without demo.

then you can find out what should to do.

there is a lot of work to do ,isn’t it?

thanks to cihappy2’s configuration sample, it corrects mine and makes my srbac work

Thanks for you reply sys2009. However, what i’m wondering is how the alwaysAllowed GUI interface works? I can define my alwaysAllowed actions in my config no problem, which I can do, although I would like to try and figure out what im doing wrong.

This is my config…




				   'srbac' => array( 

				     'userclass'=>'User', 

				     'userid'=>'id', 

				     'username'=>'username', 

				     'debug'=>true, 

				     'pageSize'=>10, 

				     'superUser' =>'Authority', 

				     'css'=>'srbac.css',  

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

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

					 'alwaysAllowed'=>'gui',

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

					 'listBoxNumberOfLines' => 15,

					 'useAlwaysAllowedGui'=>true,

				     'imagesPath' => 'application.modules.admin.modules.srbac.images', 

				     'imagesPack'=>'tango',

					 'iconText'=>true,

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

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

					 'showHeader'=>true,

					 'showFooter'=>true 

						),



the latest work is following the srbac_guide to assign.

Hey Spyros,

I’m gathering that using the alwaysAllowed GUI interface saves/removes/updates preferences to the array in allowed.php

Can you confirm this as it is not currently working for me. Everything else is working great though.

thanks

Yes, having capital letters in database table names is no good thing ;)

The database will save the names in lower case and srbac will think that the tables are not created

Yes the guide css attribute is just an example if you want to use not the default css. It should point to a css file that really exists. It’s better to start with the default css and then create your own. The red css existed as an example in srbac but now it does not exist anymore

Yes, as long as the allowed.php file is writabble by the server.

If you have problems check this first. If there’s still no saving there see if you have any error in firebug.

There’s no need to set useAlwaysAllowedGui to true. This is internally used by srbac. You only have to either set

alwaysAllowed to "gui" or not set it at all

You don’t have to do anything.Just make sure that allowed.php is writtable

The user actions in config:

When autocreating oper / tasks all operations that include the userActions words are assigned to XXXXViewing task

So if you are autocreating for controller Post all operations will be assigned to the PostAdministrating task but to PostViewing task will be assigned only PostShow, PostList, PostView operations (if the exist)

I figured as much I was just trying anything and copied it from someone else’s on the forum.

Can’t believe it was so easy either – chmod – permissions set and works like a charm.

‘User actions’ makes sense now… wasn’t sure how it tied in but I do now.

Thanks heaps again! :D

I added an attribute "alwaysAllowedPath" to set the path where the allowed.php file is saved

Just add it in config




<?php

"alwaysAllowedPath"=>"application.components",

?>



This will use the file protected/components.allowed.php as the always Allowed file.

The directory pointed by alwaysAllowedPath must be writable so the file can be created or you can create the file manually and set it to writable.

Also I added a check so if the file is not writable a message is displayed.

All updated code is in the SVN repository

http://code.google.com/p/srbac/source/checkout

well,great work ,just thank you~~

study your coding:-)

Fantastic work Spyros! Great additions, very flexible. I like it! :D

Hi Spyros, there happens a little problem:

OS: winxp sp3

IE7

when I enter http://localhost/belief/index.php?r=srbac/authitem/assign

IE7 report:

line:261

char:2

error: expecting identifer,string or numerical

code:0

url:http://localhost/belief/index.php?r=srbac/authitem/assign

it should be an IE and firefox not compatible’s problem

================

well, it works well in Firefox

This is a javascript error

Usualy when defining an array with an extra comma

eg

item = {

a: function() { },

b: function() { },

}

Only happens in IE 7 and I can’t reproduce it right now.

could you attach the generated code of the page with the error?

I have translasted srbac into Chinese 中文界面,需要的我可以发给他,注意,在IE7下无法运行分配功能,只能浏览,建议在firefox下运行开发管理。

下面是中文翻译界面截图:

well,when I tried to get the wrong page’s source code, it reported error and couldn’t get it,however, I don’t think any developer not installed firefox to develop web app, so it maybe not a big problem.