Release Notes

- Enhancement: allow admins to define a role when adding a user from admin insterface

- Bugfix: the role should not default to logged in user role, when user_guid is provided

- Bugfix: reset 'roles_hash' plugin setting, when roles are deleted

- Enhancement: expose automatic reset as a plugin setting, and delete roles on plugin deactivation rather than activation

  • I cannot seem to be able to use a role extending the admin role. I have installed the roles and "Moderators for roles" plugins have just tried modifying the config in the "Moderators for roles" plugin as follows:

    function roles_moderators_config($hook_name, $entity_type, $return_value, $params) {

            $roles = array(

                    'moderator' => array(

                            'title' => 'roles_moderators:role:title',

                            'extends' => array(ADMIN_ROLE),

                            'permissions' => array(

                                    'pages' => array(
                                    ),

                                    'menus' => array(
                                    ),

                                    'actions' => array(
                                    ),

                                    'views' => array(
                                                    ),
                            )
                    )
            );

            if (!is_array($return_value)) {
                    return $roles;
            } else {
                    return array_merge($return_value, $roles);
            }
    }

    I did assign the moderator role to a test user. I then logged in as that user but I still did not have access to, for

     example, the admin pages. And I did check the user role was indeed "Moderator".

  • Is the plugin following the logic that a user has to be given full admin privileges; the the plugin restricts access to certain pages, actions, event, etc)?

  • I would like to do various actions whenever a user has changed to a certain role (update some metadata, send some notifications, etc...)
    My functions listen to the create relationship event for the 'has_role' relationship where 'guid_two' is my role guid. So far so good, this works perfectly and my custom code is excecuted whenever that role is assigned to a user.

    My problem now is that whenever a user is assigned back to 'no specific role' I need to undo my actions. I thought I could just listen to the delete relationship event for that role (since the relationship is deleted) and do whatever I want then in my function, but now it seems there is no 'delete relationship' event triggered at all while this relationship seems to be removed.

    Is there any option for me to execute my custom code when users lose their role?
    Thanks!
     

  • I assume to you are using Elgg 1.8. Try 'delete','has_role'

  • No 1.9, when log all events and hooks I can't even find an event or a hook in my log that unsets the relationship. 

  • @driesdk So the roles plugin works fine for you in 1.9? Would be great to know in advance if there are any severe problems in combination with 1.9

  • Hello, 
    I found this warning in roles plugins :

    PHP WARNING: "array_intersect(): Argument #2 is not an array" in file /var/www/honeybee/mod/roles/lib/roles.php (line 590),

    PHP WARNING: "implode(): Invalid arguments passed" in file /var/www/honeybee/mod/roles/start.php (line 254),

    I think we should check the second argument to be an array to prevent releasing these warnings in both cases.

  • Hi!, I need no limit access to certain users to only a group, and to send messages. I tried with hundred of role configurations and regex strings but I cant achieve it, for example:

    'testrole' => array(
        'title' => 'test:role:title',
            'extends' => array(),
            //'extends' => array(DEFAULT_ROLE),            
            'permissions' => array(
                'actions' => array(
                    'groups/edit' => array('rule' => 'deny'),
                    'groups/add' => array('rule' => 'deny'),
                    //'discussion/add' => array('rule' => 'deny'),                
                ),            
                'pages' =>
                      array (          
                        'regexp(/^.*\/((?!profile\/{$group_guid}|inbox\/{$self_username}).)*$/)' =>
                        array (
                          'rule' => 'deny',
                          'forward' => 'groups/profile/74',
                        ),                      
                        
                        'groups/profile/{$group_guid}' =>
                        array (
                          'rule' => 'allow',
                        ),
    
    ...

    Any idea how can I do it?. I also tested some plugins like https://github.com/ColdTrick/test_panel and https://github.com/arckinteractive/block_users but without results.

Arck Interactive

You imagine. We create. We develop custom social networks, content management systems and other rich internet applications. We help entrepreneurs and creative agencies breathe life into their visions. Let's start a conversation!

Stats

  • Category: Uncategorized
  • License: GNU General Public License (GPL) version 2
  • Updated: 2017-5-27
  • Downloads: 8144
  • Recommendations: 46

Other Projects

View Arck Interactive's plugins