Share » Learn » eZ Publish » Creating Custom Admin Modules & Views

Creating Custom Admin Modules & Views

Monday 18 April 2011 2:42:34 pm

  • Currently 4 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Modules and Permissions

So far, we have assumed the only users with access to our module, are admin users with rights to all of the eZ Publish system. We will now cover the stages to make our module available for another type of user within the CMS.

Please note the Roles and Permissions system is extremely flexible and powerful in eZ Publish and so we will concentrate on what we need to do to make the module accessible. I am doing the first changes from a fresh install.

 

Updating the Role

Click on the “User Accounts” tab in the CMS. If you know the name of the role you need to update, you can click on the Roles and Policies link in the left hand column. If you do not, or if you want to see limitations associated with the User Group roles, click on the User Group you want to give permission. These are found in the main content towards the bottom of the page. From the User Group page, click on the Role associated with the user.

In our example, let’s update the role associated with the User Group “Editors”. Once the User Group is displayed for editors, click on the “Roles” tab and you should see a list of roles and limitations associated with Editors. If you are building from a fresh build the roles will look similar to the below.

Existing editor permissions

 

For our module this is an issue as Editor’s only have access to the Content and Media tabs (as they should). However, we need to make sure that when the User List is displayed, the editors also have permission to see the users in the mailing list (currently they will be shown an empty list).

From this though we know the Role we need to update the “Editor” role. Click on Editor in the Roles tab and the Editor role will be displayed, along with associated policies. There are several additions we need to make:

  • Allow Editors to see the site members’ details
  • Allow editors access to the Users List page
  • Allow editors access to the Send Email page

To do this, click on the edit button below the list of policies. To allow Editors to see the site members’ details we need to do two things. Firstly we need to make sure the policy allows them to read from the “User Accounts” tab. Secondly we need to restrict their view of this to site members only.

To allow Editors to read from the “User Accounts” tab, find the following policy and click the edit button in the right hand side of the row:

Read policy to update

 

You will now see a set of drop downs. In the “Section” drop down, add the “Users” section to the list of sections already available and then press the OK button at the bottom of the page.

Now let’s ensure that the Editor is restricted to seeing only Members. We do this when we assign the role so go to the bottom of the “Edit <Editor> Role” page and click on the save button. You should now be back at the main page for the Editor role. Go to the bottom of the page and you will be presented with a list of User Groups who have this role and you will notice Editors are in here twice for different areas of the site. We need to add them for a third time. While the dropdown next to “Assign with limitation” is set to subtree, press the “Assign with limitation button. Browse to the User Accounts tab and select the radio button for “Members”. Now press OK and then check the “Editors” checkbox before clicking on OK again. Your Editors will now have read access to all users with the Members usergroup. If you wish to allow Editors to remove users from the mailing list repeat the same process but this time for the content edit function.

We now need to give the users access to our new module. the User Role “Editor” again by clicking on the “Edit” button. This time go to the bottom of the existing policies and click the button “New Policy”. Select our module from the “Modules” dropdown and then assign the function you want to provide access to (we want to do both so do this for each) and then click on “Grant Full Access”.

All of our policies should now be setup for Editors to use our Module.

 

Printable

Printer Friendly version of the full article on one page with plain styles

Author(s)