Managing user roles & permission in Drupal 8
One of the reason why Drupal is hugely popular for content management application development, because of customizable content authoring workflow. We can simulate good old editorial experience where authors create the article, sub-editor review it and finally editors will confirm & publish if all organization lead criteria are met. In Drupal we create this permission system by creating roles.
Instead of assigning specific permissions to each user, permissions are assigned to roles. And then specific users are assigned role(s) e.g. author, reviewer, editor.
In this post we will explore how to create roles, specify permission for the role and assign specific role to user.
Step 1: First step is to go to Manage >> People >> Roles. Here you will find three default roles of "Anonymous", "Authenticated", and "Administrator" along with option to add new roles by clicking on +Add role.
Anonymous: Site visitors not signed in to your website. Generally they can view the pages of website.
Authenticated: Signed-in site visitors who are registered users on Drupal site.
Administrator: Signed-in administrative "super-users" of site. This role is always assigned every permission for every module which is enabled. Administrators have full access to all available functionality on your site. If we need, we can remove permission for certain functionalities.
Step 2: click on +Add role to add new role, which can be assigned to user. Here I’m creating a role called “Content Manager”.
Once the role is added,. it will show up in role listing page.
Step 3: Now it’s a time to assign our custom role “Content Manager” to the user.
Go to user listing page & edit one of the user.
On user edit page go to Roles section. check on “Content Manager” and click on save button.
So, we have assign “Content Manager” role to one of the user. and it start listing on user listing page with new role.
Site permission let you control what users can do and see on your website. there are Many different functions and features available on Drupal site that can have a permission that you can enable or disable.Permissions control access to administrative tasks and general website usage such as viewing published content.
Step 4: Finally, we can configure permissions for Content Manager at Manage >>People >> Permissions tab. To give Content Manager the ability to edit any page within the site, scroll down the permissions page and click the checkbox next to 'edit any' for each content type.
Now login with new user we just assigned the role of “Content Manager”. You will get edit option for all the basic page like below.
This was one of the simplest role with permission we have added. This can be used as foundation to create organization specific content authoring workflow.