Omeka_Controller_Action_Helper_Acl

class Omeka_Controller_Action_Helper_Acl

Package: Controller\ActionHelper

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

property _acl

ACL object.

property _currentUser

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

property _allowed

Temporarily allowed permissions.

property _autoloadResourceObject

Whether we should automatically try to set the resource object.

__construct(Zend_Acl $acl, $currentUser)

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

Parameters:
  • $acl (Zend_Acl) –
  • $currentUser (unknown) –
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
isAllowed(string $privilege, $resource)

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 thatresource should not be controlled. This allows plugin writers toimplement 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 controllerclass minus ‘Controller’, e.g.Geolocation_IndexController -> ‘Geolocation_Index’CollectionsController -> ‘Collections’

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

boolean

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
setCurrentUser(User|null $currentUser)
Parameters:
  • $currentUser (User|null) –
setAllowed(string $rule, boolean $isAllowed = 1)

Temporarily override the ACL’s permissions for this controller

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

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

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

Try to get the current resource object for the request.

Returns:Zend_Acl_Resource_Interface|null
_isLoginRequest()