Omeka_Controller_Action_Helper_Acl

Package: Controller\ActionHelper

class Omeka_Controller_Action_Helper_Acl

extends Zend_Controller_Action_Helper_Abstract

Leverages the ACL to automatically check permissions for the current controller/action combo.

property Omeka_Controller_Action_Helper_Acl::$_acl

protected Zend_Acl

ACL object.

property Omeka_Controller_Action_Helper_Acl::$_currentUser

protected User|null

User record corresponding to the logged-in user, otherwise null.

property Omeka_Controller_Action_Helper_Acl::$_allowed

protected array

Temporarily allowed permissions.

property Omeka_Controller_Action_Helper_Acl::$_autoloadResourceObject

protected boolean

Whether we should automatically try to set the resource object.

Omeka_Controller_Action_Helper_Acl::__construct($acl, $currentUser)

Instantiated with the ACL permissions which will be used to verify permission levels.

Parameters:
  • $acl (Zend_Acl) –
  • $currentUser
Omeka_Controller_Action_Helper_Acl::preDispatch()

Determine whether or not access is granted to a specific controller/action.

If the user has been authenticated, display the Access Forbidden error page. Otherwise, give the user an opportunity to login before trying again.

Returns:void
Omeka_Controller_Action_Helper_Acl::isAllowed($privilege, $resource = null)

Notifies whether the logged-in user has permission for a given resource/ privilege combination.

If an ACL resource being checked has not been defined, access to that resource should not be controlled. This allows plugin writers to implement controllers without also requiring them to be aware of the ACL.

Conversely, in the event that an ACL resource has been defined, all access permissions for that controller must be properly defined.

The names of resources should correspond to the name of the controller class minus ‘Controller’, e.g. Geolocation_IndexController -> ‘Geolocation_Index’ CollectionsController -> ‘Collections’

Parameters:
  • $privilege (string) –
  • $resource
Returns:

boolean

Omeka_Controller_Action_Helper_Acl::getResourceName()

Retrieve the name of the ACL resource based on the name of the controller and, if not the default module, the name of the module.

Returns:string
Omeka_Controller_Action_Helper_Acl::setCurrentUser($currentUser)
Parameters:
  • $currentUser (User|null) –
Omeka_Controller_Action_Helper_Acl::setAllowed($rule, $isAllowed = true)

Temporarily override the ACL’s permissions for this controller

Parameters:
  • $rule (string) –
  • $isAllowed (boolean) –
Omeka_Controller_Action_Helper_Acl::setAutoloadResourceObject($autoload)

Set whether the ACL helper should try to automatically load a resource object from the request.

Parameters:
  • $autoload (boolean) –
Omeka_Controller_Action_Helper_Acl::_getResourceObjectFromRequest()

Try to get the current resource object for the request.

Returns:Zend_Acl_Resource_Interface|null
Omeka_Controller_Action_Helper_Acl::_isLoginRequest()