A free and open-source book on Zend Framework for beginners


17.8. Implementing Permission Management

In the Role Demo sample, we will create a convenient user interface for managing permissions. It will be useful if you plan to add new permissions or remove existing ones.

You can access the permission management page by logging in as admin@example.com and opening menu Admin -> Manage Permissions.

The permission management will be implemented inside the PermissionController controller living in the User\Controller namespace. The action methods of the PermissionController are listed in table 17.5:

Table 17.5. Actions of the PermissionController controller
Action Name Description
addAction() Allows to add a new permission.
deleteAction() Deletes an existing permission.
editAction() Allows to edit an existing permission.
indexAction() Displays the list of existing permissions.
viewAction() Displays the details of a permission.

The PermissionController works in pair with the PermissionManager service which lives in User\Service namespace.

The PermissionController and PermissionManager contain nothing new and special, so we will skip their discussion here and will just provide some screenshots of the resulting user interface below.

You can find the complete code of the PermissionController and PermissionManager classes in the Role Demo sample.

Figure 17.8 The list of permissions Figure 17.8 The list of permissions

Figure 17.9 Create a new permission Figure 17.9 Create a new permission

Figure 17.10 View details of a permission Figure 17.10 View details of a permission

Figure 17.11 Edit an existing permission Figure 17.11 Edit an existing permission


Top