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

yes spyros

i have created operations/roles and assigned to users

then what i have to do using this

what is the use of your module

please explain

You have to check if the current user has access to the page in your controllers

read here http://www.yiiframework.com/doc/guide/topics.auth




To perform access checking, we first need to know the name of the authorization item. For example, to check if the current user can create a post, we would check if he has the permission represented by the createPost operation. We then call CWebUser::checkAccess to perform the access checking:


if(Yii::app()->user->checkAccess('createPost'))

{

    // create post

}



Thanks spyros

now i am following your instructions

Thanks spyros

Perfectly well

Super creation

All are works

Thanks again

Hi spyros

how to set how much time an user can login without any operation for authentication

I don’t understand your question.

when i logon to my application then i did nothing then when it expires my logon account

This has to do with your login system

If you use cookies or session set the time out in your login script

Very nice!

I got it working, as a nested module! But, this was just a test.

I had to tweak the code a little bit.

Some lines refer directy to the module srbac, which breaks the code, when using it a as nested module:


Yii::app()->getModule('srbac')

I also posted an issue here:

http://www.yiiframework.com/forum/index.php?/topic/4261-how-to-getmodule-for-a-nested-module/

If you have an idea how to fix this, it would be great!

Best regards,

schmunk

I think a Yii:app()->findModule(‘moduleID’) that will search all child modules of App would be handy.

I don’t know if such a function exists so I made one.

I attach a version that’s only tested as

app/modules/srbac

and

app/modules/parent/modules/srbac

and it seems to work.

But because my parent module is a fake one please test it with yours.

Thanks

ευχαριστώ!

I think this would be a cool feature, think about posting a ticket.

And so it does! :rolleyes: Release it!

Two more things:

First, srbac throws a few notices, it would be nice if either you could debug them or, as a workaorund, if you could add this line:


<?php


error_reporting(E_ALL ^ E_NOTICE);


class SrbacModule extends CWebModule {

to the SrbacModule.

And, second, loading indicators would be also very nice:

http://www.yiiframework.com/doc/cookbook/46/

Best regards,

schmunk

btw there’s already a findModule() method: http://www.yiiframework.com/doc/api/CWebApplication#findModule-detail

Yes I didn’t know it.

But

"…Searches for a module by its ID. This method is used internally. Do not call this method."

About the notices I thought I fixed them all but it seems that some are not fixed.

Do you have the errors it threw?

The ajax indicators is something that I was thinking about today :)

Thanks

Hi I also tried to install this extension in my application.

But I have a problem with it :S

srbac/authItem/assign works perfectly

but

srbac/authItem/manage

crashes my whole layout of my page.

I have several js imports in my layout/main.php also I register jquery as core script (cause its used on every page,layout, menue etc).

$cs->registerCoreScript(‘jquery’);

When i now have some code like below which comes from the autitem/manage/list.php




 $this->widget('CAutoComplete',

       array(

       'name'=>'name',

       'max'=>10,

       'delay'=>300,

       'matchCase'=>false,

       'url'=>array('autocomplete'),

       'minChars'=>2,

       )

   );



It seems that jquery is requested 2 times in my html code.

One on the top and the other on the bottom. Which them creates a JS error and makes any jquery code unuseable.

Part of the code generated by your extension.




 ...

     <div id="list" class="list">

        <link rel="stylesheet" type="text/css" href="/yii/testdrive5/assets/6f368e91/srbac.css" />

<link rel="stylesheet" type="text/css" href="/yii/testdrive5/assets/175f3f8b/autocomplete/jquery.autocomplete.css" />

<link rel="stylesheet" type="text/css" href="/yii/testdrive5/assets/2dc5f90a/pager.css" />

<script type="text/javascript" src="/yii/testdrive5/assets/175f3f8b/jquery.js"></script>

<script type="text/javascript" src="/yii/testdrive5/assets/175f3f8b/jquery.bgiframe.js"></script>

<script type="text/javascript" src="/yii/testdrive5/assets/175f3f8b/jquery.dimensions.js"></script>


<script type="text/javascript" src="/yii/testdrive5/assets/175f3f8b/jquery.ajaxqueue.js"></script>

...



Seems it doesn’t see that jquery is already imported as core script.

How can i fix this issue?

edit:

if i change the code in views\authItem\manage\manage.php




from:

   <?php echo $this->renderPartial('manage/list', array(

        'models'=>$models,

        'pages'=>$pages,

        'sort'=>$sort,

        'images'=>$images

        ), false, true); ?>

to:

<?php echo $this->renderPartial('manage/list', array(

        'models'=>$models,

        'pages'=>$pages,

        'sort'=>$sort,

        'images'=>$images

        )); ?>



It works. Is the processOutput really needed? Or do I have some coding issues in My Code?

Another problem is that it seems your are using $_REQUEST[‘id’] in your loadAuthItem function. Which seems not to work if you are using path urlManager with RewriteRule per .htacess is there anything I can do against this? Other then using $_GET or $_POST instead of $_REQUEST?




  'urlManager' => array(

        'urlFormat' => 'path',

        'showScriptName' => false,

    ),



regards Horizons

Feature Request: Please make CSS configurable.

line 32, SrbacModule:


$css =  dirname(__FILE__).'/css/srbac.css';

I think it’s the best to use a path relative to Yii::app()->basePath, like


$css =  Yii::app()->basePath.$this->params['cssFile'];

What do you think?

Best regards,

schmunk

PS: This would also be nice for CTabView ;)

Yes that would be nice

I’ll add in the next version (along with the other changes discussed previously)

Great!

Please also add a LICENSE file.

I wanna redistribute srbac as a submodule of pii … and just as a matter of form, I am German, you know ::)

Btw, here are some more of my thoughts regarding modules:

http://www.yiiframework.com/forum/index.php?/topic/4316-minor-modification-proposal-for-yiis-default-style/

Hi spyros

i created Super User,student,staff,parent,adminstaff as user types

Super User is the authority

i created two Super User but my module accepts only one Super User (first one) to do all works

and another one Super User has no permissions why?

how many users can be Super User?

i need more than 1

You Created 2 users with the same name (Super User)?

Or you created 2 users and assigned to them the Super User role?

Or you created 2 users and assigned to them the Authority role?

i created 2 users and assigned to them the Super User role(Authority)

i now find the problem since my user table has

user_ID,username,password,email,staffid,studentid,parentid

in userIdentity class

i used getId() method to return staffid or studentid or parentid which has value

this is created that problem

now i changed to return only user_ID

that clears all my problem

Sorry for wasting your golden time