nickelstar
(Nickcgates)
December 17, 2009, 8:22pm
381
I noticed that the srbac.css file was not loading and Firebug showed that the URL was being computed incorrectly. I have srbac.css under the web root css so the file should be linked with http://mysite.com/css/srbac.css but instead it was being linked to with /var/www/mysite/css/srbac.css. Obviously this is the file path and not the URL so the file will never load in a browser. I traced the issue down to line 473 of Helper.php which calls registerCssFile() with a file path. But the Yii API says that registerCssFile() should be called with a URL. So I changed that line to read:
Yii::app()->clientScript->registerCssFile("/css/$css");
This fixed my problem and srbac.css now loads correctly.
pangjanne
(Pngjanne)
December 18, 2009, 8:03am
382
There may be 3 feature in my option.
we can’t simple identify module base on ‘_’ character
in controller variable in _getControllerInfo, wo should enhance this,
this is my code:
$c = explode("_", $controller);
$modulesArray = array_keys(Yii::app()->modules);
if (in_array($c[0], $modulesArray)) {
$module = $c[0]."_";
$controller = substr($controller, strlen($module));
$contPath = Yii::app()->getModule($c[0])->getControllerPath();
$control = $contPath.DIRECTORY_SEPARATOR.str_replace(".", DIRECTORY_SEPARATOR, $controller).".php";
}
so, wo can fill ‘_’ character in controller name, but in module name.
sometimes, we don’t want to scan all file in controller path(mean to not want all contrller to be task), we can define a property liek $notScanControllerList in Srbacmodule.
my code in SrbacModule:
public $notAllowedControllerList = array('srbac_DefaultController', 'VxmlController'...);
function _scanDir()
// @janne modify
$controller = (($module) ? $module."_" : "").
(($subdir) ? $subdir."." : "").
str_replace(".php","",$file);
// @janne added
if (!in_array($controller, Yii::app()->getModule('srbac')->notAllowedControllerList)) {
$controllers[] = $controller;
}
in fact, my project need this feature, it can give our max freedom;
if our action with default argument, authitem looks ugly. eg: model_ConterllerAction arg=null.
so my code in function _getControllerInfo():
$patterns[0] = '/\s*/m';
$patterns[1] = '/\(/m';
//$patterns[2] = '/\)/m';
//$patterns[3] = '/\{/m';
// @janne modify
$patterns[1] = '/\(.*\)/m';
$patterns[2] = '/\{/m';
What do you think of it?
don’t mind my pool english and jmmq( stupid options)!
Geralt
(D Codder)
December 18, 2009, 9:18am
384
Spyros:
What’s the error in the configuration? I can’t understand it.
When i open install page, it says , that i have an error, (with no "red lines")
I use srbac from your SVN .
i’m trying to create permitions for controllers generated by - yiic shell -> crud
Spyros
(Spyros)
December 20, 2009, 7:39am
385
nickelstar:
I noticed that the srbac.css file was not loading and Firebug showed that the URL was being computed incorrectly. I have srbac.css under the web root css so the file should be linked with http://mysite.com/css/srbac.css but instead it was being linked to with /var/www/mysite/css/srbac.css. Obviously this is the file path and not the URL so the file will never load in a browser. I traced the issue down to line 473 of Helper.php which calls registerCssFile() with a file path. But the Yii API says that registerCssFile() should be called with a URL. So I changed that line to read:
Yii::app()->clientScript->registerCssFile("/css/$css");
This fixed my problem and srbac.css now loads correctly.
Thanks,
The code that worked for me was
<?php
Yii::app()->request->baseUrl."/css/".$css;
?>
It’s fixed along with some other css problems in SVN
Spyros
(Spyros)
December 20, 2009, 7:45am
386
pangjanne and geralt,
I will be away for Christmas holiday so I will check your issues when I get back.
Geralt
(D Codder)
December 21, 2009, 1:46pm
387
SOLVED!
I’ve found the problem - i’ve used an “underscore” in the name of my tables, so i had symbol “_” in the names of my controllers.
And this part didn’t work for me (AuthItemController)
if(substr_count($controller, "_")) {
$c = explode("_", $controller);
so i had to add an exception for "srbac" and my modules.
Thanks for your help !
Happy holidays
cihappy2
(Cihappy2)
December 28, 2009, 3:46am
388
hey spyros,
i have a problem ,that is I use srbac to create admin,and role is "admin,administrator,user"
and task like user_management for example, and there is "usercreate userdelete " in the task.
i realy can use admin to do the user_management task.
and i can user authmanager->getTask(); return "user_management" task.
however, i use authmanager->getTask(‘admin’) ,and return nothing?
what’s the problem with api?
thank you
I made a Portuguese translation to srbac.
Thanks for this great extension.
Sérgio Villela
I found a typo on the file. Here is the correction.
Sérgio
ptoly
(Nospam)
January 11, 2010, 11:41pm
391
I have a fresh install of Yii 1.1 and a fresh install of RBAC. When I go to install RBAC I got error messages about missing layout files.
When I commented out the default layout setup as follows:
//The layout to use
//"layout"=>"application.views.layouts.admin",
I get:
Application.log reports:
2010/01/11 18:21:38 [error] [system.db.CDbCommand] Error in querying SQL: SHOW COLUMNS FROM items
2010/01/11 18:21:38 [error] [system.db.CDbCommand] Error in querying SQL: SHOW COLUMNS FROM items
2010/01/11 18:23:52 [error] [system.db.CDbCommand] Error in querying SQL: SHOW COLUMNS FROM items
2010/01/11 18:25:11 [error] [system.db.CDbCommand] Error in querying SQL: SHOW COLUMNS FROM items
2010/01/11 18:25:11 [error] [exception.CException] exception ‘CException’ with message ‘Property “AuthitemController.breadcrumbs” is not defined.’ in /webroot/yii/framework/base/CComponent.php:131
I was under the impression that RBAC should install these tables during initialization?
Spyros
(Spyros)
January 12, 2010, 5:03am
392
ptoly:
I have a fresh install of Yii 1.1 and a fresh install of RBAC. When I go to install RBAC I got error messages about missing layout files.
When I commented out the default layout setup as follows:
//The layout to use
//"layout"=>"application.views.layouts.admin",
I get:
Application.log reports:
I was under the impression that RBAC should install these tables during initialization?
//The layout to use
//"layout"=>"application.views.layouts.admin",
This is an example for how to use a different layout for srbac. Probably protected/views/layouts/admin.php does not exist so there’s an error.If you comment the line the default layout is used that has the new Yii 1.1 breadcrumbs attribute.
I will fix the problem for Yii 1.1 version.
The tables are created during the install of srbac
ptoly
(Nospam)
January 13, 2010, 4:37pm
393
Thanks! Looking forward to the fix.
ptoly
(Nospam)
January 13, 2010, 4:39pm
394
Thanks! Looking forward to the fix.
Spyros
(Spyros)
January 19, 2010, 5:52am
395
May be due to me being n00b in Yii, but I couldn’t understand this->
I followed the documentation and added all the required configuration options. Now I am able to do all the changes using the srbac interface and all the changes are being saved into the db also. But the biggest issues is the changes are not being reflected in views. Should I add some function/code to the controllers to make the access rules work. Currently, no srbac access rules are ina ction and its behaving according tot he default accessrules function in the controllers. Please help
PS:I registered in the forum all just due to SRBAC.
Spyros
(Spyros)
January 21, 2010, 7:38am
397
If you are using the auto creation access rules tool, your controllers should extend SBaseController.
Else you have to checkAccess in every action manually.
bemit
(In Yorshire)
January 21, 2010, 2:39pm
398
Undefined variable: sort
Source File
E:\servers\wamp\www\LA17\protected\modules\srbac\views\authitem\admin.php(28)
00016: * @obsolete
00017: */
00018: ?>
00019: <h2><?php echo Helper::translate(‘srbac’,‘Managing AuthItem’)?></h2>
00020:
00021: <div class="actionBar">
00022: [<?php echo CHtml::link(Helper::translate(‘srbac’,‘AuthItem List’),array(‘list’)); ?>]
00023: [<?php echo CHtml::link(Helper::translate(‘srbac’,‘New AuthItem’),array(‘create’)); ?>]
00024: </div>
00025:
00026: <table class="srbacDataGrid">
00027: <tr>
00028: <th><?php echo $sort ->link(‘name’); ?></th>
…
I get trouble. Who can help me??? Thanks!!!
Spyros
(Spyros)
January 21, 2010, 8:06pm
399
bemit:
Undefined variable: sort
Source File
E:\servers\wamp\www\LA17\protected\modules\srbac\views\authitem\admin.php(28)
00016: * @obsolete
00017: */
00018: ?>
00019: <h2><?php echo Helper::translate(‘srbac’,‘Managing AuthItem’)?></h2>
00020:
00021: <div class="actionBar">
00022: [<?php echo CHtml::link(Helper::translate(‘srbac’,‘AuthItem List’),array(‘list’)); ?>]
00023: [<?php echo CHtml::link(Helper::translate(‘srbac’,‘New AuthItem’),array(‘create’)); ?>]
00024: </div>
00025:
00026: <table class="srbacDataGrid">
00027: <tr>
00028: <th><?php echo $sort ->link(‘name’); ?></th>
…
I get trouble. Who can help me??? Thanks!!!
What version of srbac do you use?
Which is the url that rendered that view? This view is obsolete and not accessible anymore.
tresero
(Jongriffinjr)
January 22, 2010, 12:18am
400
Is there a guide to install for idiots like me? i am thoroughly confused.
I don’t know where to add all the config like:
‘srbac’ => array(
‘userclass’=>'User
…
I put that in my main.php, but I get this:
Property "CWebApplication.srbac" is not defined.
I am completely lost,
Thanks