Skip to content
Jean-Guy Landriault edited this page Jan 4, 2016 · 1 revision

Roles

If you have the watchtower.acl.role.index permission, you will be able to view the role index list. By default pagination is set to 15 items. Watchtower Configuration will allow you to change that value for roles.

💡 Tip Roles with the special "all-access" attribute will be marked with a star icon. Likewise, roles with the special "no-access" attribute will also be marked with a circle-slash icon for instant visibility.


Create Role

If you have the watchtower.acl.role.create permission, when you view the role index list, you will see a large "+ Add New Role" button above the list of roles.

Clicking that button will bring you to a form to input your new role. The Name and Slug fields are mandatory while the Description field is optional. The final field, Special Access allows you to make use of Shinobi's special access attributes to assign a role as "All Access" (i.e. superadmin) or "No Access" (i.e. banned). The Special Access attribute supercedes all other permission options so be very careful before using this attribute on you role.

Note The name field is a user-friendly name for your personal reference within your application. It is not used for access control, that is the purpose of the slug field. The slug field, not the name field, is the field that Shinobi validates against when checking role() or the magic method of isRole()(where you replace "Role" with the role's slug value).

For example, you can use the Name "Super Duper Administrators what got all the power" for user-friendly naming and the slug of "admin" for actual coding. When you use Shinobi to validate access control you would use role('admin') or the magic method ofisAdmin().


Show Role

If you have the watchtower.acl.role.show permission, when you view the role index list, you will be able to click on the Name of the role and be brought to a page that will show you information about that role, with links to its associated permissions, associated users or to edit the role.

NOTE Clicking on the "Users" link at the bottom of the form, will bring you to the User Sync page so you can view and/or modify the users associated with the role.

Clicking on the "Permissions" link at the bottom of the form, will bring you to the Role Permission Sync page so you can view and/or modify the permissions associated with the role.


Edit Role

If you have the watchtower.acl.role.edit permission, when you view the role index list, you will see an "Update" button for each role. (in the following image, the button is coloured grey and is the third button in the group of four buttons)

Clicking that button will take you to the form to edit the properties of the role. The Name and Slug fields are mandatory while the Description field is optional. The final field, Special Access allows you to make use of Shinobi's special access attributes to assign a role as "All Access" (i.e. superadmin) or "No Access" (i.e. banned). The Special Access attribute supercedes all other permission options so be very careful before using this attribute on you role.


Destroy Role

If you have the watchtower.acl.role.destroy permission, when you view the roleindex list, you will see a "Delete" button for each role. (in the following image, the button is coloured red and is the last in the group of buttons)

If you click that button, you will need to confirm that you want to delete the role.

NOTE If you confirm and delete the role, it is gone. There is no going back.


Role Matrix

The role matrix is the most useful of the role pages provided with Watchtower. It allows you to view and/or modify all your permissions <--> role associations in one big matrix where you can check off the boxes needed to assign multiple permissions to multiple roles all at one time.

Once you have made all the changes necessary, click the big "Save Role Permission Changes" at the bottom of the form and it will update all your roles to have all the selected permissions.

NOTE This is a destructive / constructive database transaction. It will remove all entries in the permission_role pivot table in your database, reset the incremental counter back to 1, then import all of your permission <--> role associations from the matrix form.


Role Permission Sync

If you have the watchtower.acl.role.permission permission, when you view the role index list, you will see a "Permissions" button for each role. (in the following image, the button is coloured blue and is the first in the group of buttons)

If you click on that button you will be shown which permissions are currently assigned to that role and all the other permissions available to be assigned to that role. Check off the boxes as appropriate and then click the Update button.

💡 Tip If you look closely, you will see there is a count of Available Roles and Current Roles in parenthesis in the appropriate headers.


Role User Sync

If you have the watchtower.acl.role.user permission, when you view the role index list, you will see a "Users" button for each role. (in the following image, the button is coloured blue and is the second in the group of buttons)

If you click on that button you will be shown which users are currently assigned to that role and all the other users available to be assigned to that role. Check off the boxes as appropriate and then click the Update button.

💡 Tip If you look closely, you will see there is a count of Current Users and Available Users in parenthesis in the appropriate headers.


Role Search

If you have the watchtower.acl.role.search permission, when you view the role index list, you will see a search box directly below the title with a count of how many records were found.

It will also list any filter used, if any, and a link to clear the filter.

Note Searching is not a complicated intensive affair, this is a simple lookup box. This is not a super-duper google style search box. It is a simple string match against the 3 fields (name, slug, description). So a search for "create edit" will only match roles that have that exact phrase in that order in any of the 3 fields.

Clone this wiki locally