#200

Product support

Get help in the plugin support forum.

Categories

  • Social
  • Utility

This plugin allows to manage access rights for front-end users based on roles hierarchy.

Features

  • create your roles and permissions
  • group roles into parent - children relations
  • manage access to a CMS page
  • use Twig helpers to allow or restrict access in views

You may like my other plugins

Requirements

Backend

Quick start

First, create some roles and/or permissions in Users > Roles Hierarchy.

Optionaly to use the power of roles hierarchy create roles system by assigning parent - child relations between them. Then you can create some permissions and assign them to roles depending on hierarchy (check screenshot).

CMS Pages access

After at least one role is created you can choose it in CMS Page settings to allow access only for users of that role or it's parents. Another option is to manage Page access by choosing permission. Or check "Only anonymous" checkbox to restrict access for any logged user.

Frontend

You can use twig helpers or PHP static functions to allow or restrict access.

Check if user got specific role

Twig: isRole(role_code, user = null)
PHP: Helper::isRole(role_code, user = null)

Checks if current user has specific role or a role with higher privileges (roles ancestors). Example: if user is got admin role: isRole('admin') and isRole('superadmin') will return true.

Check if user got specific permission

Twig: able(permission_code, user = null)
PHP: Helper::able(permission_code, user = null) 

Checks if current user's role has right to execute a permission. Permission should be assigned to the user's role or to a role with lower privileges (roles successors).

Pass user object as second parameter to check it rather then authenticated user.

  • Found the plugin useful on 10 Aug, 2016

    There is a hardcoded URL to the " /admin" area if the user has a different Backend URL the links will not work. Found in the following files:

    ~/roles/controllers/roles/index.htm Upon the lines 16, 18, 31 ~/roles/controllers/Roles.php Upon the line 38

    Works perfect btw.

  • author

    Replied on 10 Aug, 2016

    Thanks! Added new version with this fix

1.1.3

Logged only CMS page parameter added

Mar 14, 2017

1.1.2

Fixed bug wich prevented returning the whole ancestor tree in a role (thanks Daniel Tamas). En translations updated

Jan 25, 2017

1.1.1

CMS Pages access managment moved to separate tab

Jan 24, 2017

1.1.0

CMS Pages access managment by assigning roles and permissions

Dec 14, 2016

1.0.5

Replaced hardcoded backend urls with dynamic links in controller (thanks to Damian Verhaar)

Aug 21, 2016

1.0.4

Replaced hardcoded backend urls with dynamic links in view (thanks to Damian Verhaar)

Aug 10, 2016

1.0.3

SimpleTree trait implemented, fixed roles dropdown in user form

Aug 08, 2016

1.0.2

Soft implementation of RainLab.Translate

Aug 04, 2016

1.0.1

Permission name transaltable. Readme update. Move static methods to Helper

Aug 04, 2016

1.0.0

Initialize plugin.

Jul 29, 2016