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

Linux paths are case sensitive, but I don’t see any error in the paths

may be php 5.3 is the reason?

I don’t think so, which version of Yii are you using?

Last 1.0.9

I use 1.09 too, this is not the problem

May be this will help you:

AuthitemController.php (744)


    public function actionFrontPage() {

        $this->render('frontpage');

    }

won’t work, but


    public function actionFrontPage() {

        $this->render('/authItem/frontpage');

    }

works good

‘/authItem/’ added in all renderPartial fix the problem

hmmm Ubuntu - fixed, but in Debian won’t :)

can’t find view “/authItem/tabViews/roleToUser” and “authItem/tabViews/roleToUser” and “tabViews/roleToUser”

$this->getViewPath() return ‘/var/www/mysite/htdocs/protected/modules/srbac/views/authitem’

but i think it must be ‘/var/www/mysite/htdocs/protected/modules/srbac/views/authItem’ because of case sensitivity

Yes, it is bug in your logic: views can not be named with camel, because of model names

that is works for me, you can test it in other OS, in debian it’s ok: 335

srbac.zip

The authItem controller should not need the authItem part in the renders because getViewPath returns the view path of the module plus the controller’s ID (protected/modules/srbac/views/authItem )

try to change the widget data in assign.php to




$tabs = array(

    'tab1'=>array(

          'title'=>$this->module->tr->translate('srbac','Users'),

          'view'=>'tabViews/roletouser',

    ),

    'tab2'=>array(

          'title'=>$this->module->tr->translate('srbac','Roles'),

          'view'=>'tabViews/tasktorole',

    ),

    'tab3'=>array(

          'title'=>$this->module->tr->translate('srbac','Tasks'),

          'view'=>'tabViews/operationtotask',

    ),

);



>plus the controller’s ID - yes, and its returns authitem, but not authItem, i have checked

I can’t test it in other OS right now.

You only changed the authItem dir to authitem?

If that’s the case i will include it in the next update.

Thanks

and rename it in other files

actually, i cant tell you where i’ve made changes 'cos don’t remember :) you can use diff

Ok, thanks

Spyros - thanks for the quick update. FYI : v 1.02.05 zip archive contains two identical versions of most files.

Actually - I’m still having the problem with unable to see available Roles during User->Role assignment. I have my user table & column names configured ok - the view sees the usernames, but displays no available roles.

Also - I’m having real problems using SBaseController to extend my controllers.

First new issue - Yii cannot include SBaseController.php unless I add to ‘import’ section of config ‘application.modules.srbac.controllers.*’, which should not be necessary since srbac is already defined in ‘modules’ section.

Second new issue - even if I fix ‘import’ as above, when I load a controller extended from SBaseController, I get an error that ‘debug’ is not defined. In SBaseController.php l.33 it references “!Yii::app()->params->debug” which does not exist for me. Is this intended to be a reference to ‘debug’ property of srbac? In which case shouldn’t it be “!Yii::app()->controller->srbac->params->debug” ? but even this gives an error “MyController.srbac” is not defined.

Bottom line - somehow I do not have the module installed properly so its classes and their properties are available. I followed all instructions on http://www.yiiframework.com/extension/srbac/#doc in section "srbac in modules", and configured for my situation.

Am I missing something? or is this bug in using SBaseController ?

1.Could you please check with firebug if there’s an error in the ajax call?

2.Why do you mean by "Yii cannot include SBaseController.php"?Is there a problem importing it in the config?

import it or include it inside your controllers before the controller definitions won’t work?

3.Yii::app()->params->debug is a test parameter I have in my application and forgotten to remove it.I’ll remove it in the next update.

Please check the attached file

I have the following fixes

Changed view path to authitem instead of authItem due to case sensitivity errors in some operation systems.

Import SBAseController in modules init method.

Thanks

Hi Spyros,

Thanks again for the quick updates.

  1. debug is removed - good

  2. error in role assignments. I checked in firebug - this was my fault - I put users table in wrong case in config file. now it works ok

  3. with regard to my classes extending SBaseController. I guess I’m not sure how it is supposed to work. when a module is placed into config/main.php, in ‘modules’ section, do its classes automatically become available? Or if not, when/how should I import this module?

    Yii module docs @ http://www.yiiframework.com/doc/guide/basics.module

I did both these things, so I assumed I could do this:


class MyController extends SBaseController ...

but when Yii tries to include SBaseController.php I get this error

So my (temporary?) solution was to add this to autoload in config/main


'import'=>array (

   ...

   'application.modules.srbac.controllers.*',

   ),



this works, but I’m not sure it’s the right/best solution. Advice?

  • Jeremy

I think that when you define a module in config it’s classes are available only when it’s in use. So the only working solution is to import it as you have done (This is also not a real import - it’s only called when the class is needed)