I had a deeper look into rights and it seems it can (almost) work out of the box, when you dont use the same actions name in controllers that have the same name in backend and frontend.
Example:
controllers/back/FooController
controllers/front/FooController
Authitems can be generated for:
Foo.* (losing global rules because this is ambiguous)
Foo.admin (where actionAdmin is only definied in back)
Foo.show (where actionShow is only definied in front)
In order to generate items for back and front I had to change following method in RGenerator to:
in a for loop. I’m creating operations and next I’m assigning them to MyTask (install action) and revoking them and removing (uninstall action). Sometimes the assignment isn’t displayed properly in the Tasks list view. The operations whitch I’ve assigned to MyTask are displayed like they haven’t been assigned. After I’ve entered MyTask from Tasks list view to whitch I’ve assigned operations they are visible in the Children list and after switching back to the Tasks view everything looks ok. This situation is very rare but it is possible.
And one more question is there a way to do a checkAccess before redirecting based on something like this "controller/action"? For example:
In the permissions module, you can set specific permissions for Guest users that are inherited to normal users and upwards.
However, it doesn’t work. A guest user does not have the permission to do that specific action. My current solution is to set the allowedActions() function in the controller, but I should be able to just set the right permissions I think?
I too had the same issue and edited the rights code to fit with my requirement. Anyway you can generate controller actions for rights by commenting rights module checking part in getControllersInModules function in RGenarater.php. Don`t know is there any good way to doing it.
Modyfying the Rights code isn’t the best way because you have to remember to make same changes in future release of Rights - if you will be updating the module .
Rights access is restricted for superusers and it’s fine. This way u can control access to the module for specific users. If you want to let a user access Rights just assign Superuser role to that user.
You can also take a look on yii-user module there’s a similar functionality - only users that have “Superuser” property set to “Yes” can create new users.
There’s no need to fix something that doesn’t need fixing I think .
Exactly changing Rights code is not a good practice.But I want to give rights module access to end user except some actions such as "controller action generator", "permission deletion" etc…(these actions are related to developer and no need for end user). Let me know is there any way to do this without changing the code.
After install Rights, I can't upload files (pictures, PDFs and DOCs) anymore.
Maybe some Models or Controllers don't have access permission for upload.
Is it an issue?
I would like to do search function like is in the User Management module but actually I don’t know how to start with it in “Rights Module”.
Search function is in User model and looks like this:
public function search($cr=0)
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('user_id',$this->user_id);
$criteria->compare('username',$this->username,true);
$criteria->compare('user_password',$this->user_password);
$criteria->compare('user_email',$this->user_email,true);
$criteria->compare('user_regdate',$this->user_regdate);
$criteria->compare('user_lastvisit',$this->user_lastvisit);
$criteria->compare('superuser',$this->superuser);
$criteria->compare('user_active',$this->user_active);
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,
'pagination'=>array(
'pageSize'=>Yii::app()->getModule('user')->user_page_size,
),
));
}
It’s using a model and then return dataprovider
In rights CGridView is used RAssignmentDataProvider stright away.
I’ve got a lot of users and search function would be really usefull for me.
There is a little problem: Unfortunately, when translating(particularly to Russian) phrases Assign and Revoke on different pages have the opposite meaning. How can I use icons instead of words. In addition, the icons are much visually and use less space on the screen.
I am new to Yii and especially to using its extensions. rights seems quite promising and I also managed to set it up. However I also need a blog for my project and just saw that there is a bundle with rights + blog. But I don’t really get these 2 working together. In the documentation PDF is also just a guide how to set up rights on its own and not with a blog.
Can anyone tell me what steps I have to do additionally, so I can use blog + rights?
class BlogModule extends CWebModule
{
public function init()
{
// this method is called when the module is being created
// you may place code here to customize the module or the application
// import the module-level models and components
$this->setImport(array(
'blog.models.*',
'blog.components.*',
// for rights module
'application.modules.rights.*',
'application.modules.rights.components.*',
));
}
and then each of your controllers:
eg.
class SiteController extends Controller
{
public $layout='column1';
public function filters()
{
return array(
'rights',
);
}