ZenMagick 0.9.10


org.zenmagick.mvc.sacs\ZMSacsManager
mvc\sacs\ZMSacsManager.php at line 47

Class ZMSacsManager

ZMObject
└─ZMSacsManager

public class ZMSacsManager
extends ZMObject

Handle access control and security mappings.

This manager class provides abstract access to access control methods. The actual processing is delegated to implementations of the ZMSacsHandler interface.

Access control mappings define the level of authentication required for resources. Resources in this context are controller or page requests.

Controller/resources marked as secure will result in redirects using SSL (if configured), if non secure HTTP is used to access them.

Default handler (class names) may be set as a comma separated list with the setting zenmagick.mvc.sacs.handler.

To add handler dynamically the preferred way is to use addHandler() as the default handler list is only evaluated when the manager instance is created.

NOTE: The only required element for each mapping (if done via YAML) is 'level'. It is expected to be boolean and indicates whether the configured resource requires secvu

Author:
DerManoMann

Fields inherited from org.zenmagick.core\ZMObject
properties_
Method Summary
void

__construct()

Create new instance.

void

addHandler(ZMSacsHandler handler)

Add a ZMSacsHandler.

boolean

authorize(ZMRequest request, string requestId, mixed credentials, boolean action, mixed credientials)

Authorize the current request.

void

ensureAccessMethod(mixed request, string requestId)

Ensure the page is accessed using proper security.

array

getDefaultMapping()

Get the default mapping.

mixed

getMappingValue(string requestId, string key, mixed default)

Get mapping value.

array

getMappings()

Get all mapped requests.

boolean

hasMappingForRequestId(string requestId)

Check if a mapping for the given requestId exists.

static void

instance()

Get instance.

void

load(string yaml, boolean override)

Load mappings from a YAML style string.

boolean

requiresSecurity(string requestId)

Check if a request to the given page [name] is required to be secure.

void

reset()

Reset all internal data structures.

void

setMapping(string requestId, mixed authentication, boolean secure, array args)

Set a mapping.

Methods inherited from org.zenmagick.core\ZMObject
__construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton

Method Detail

mvc\sacs\ZMSacsManager.php at line 55

__construct

public void __construct()

Create new instance.


mvc\sacs\ZMSacsManager.php at line 104

addHandler

public void addHandler(ZMSacsHandler handler)

Add a ZMSacsHandler.

Parameters:
handler - The new handler.

mvc\sacs\ZMSacsManager.php at line 136

authorize

public boolean authorize(ZMRequest request, string requestId, mixed credentials, boolean action, mixed credientials)

Authorize the current request.

If no configured handler is found, all requests will be authorized.

Parameters:
request - The current request.
requestId - The request id to authorize.
credientials - User information; typically a map with username and password.
action - Optional flag to control whether to actually action or not; default is true.
Returns:
true if authorization was sucessful.

mvc\sacs\ZMSacsManager.php at line 175

ensureAccessMethod

public void ensureAccessMethod(mixed request, string requestId)

Ensure the page is accessed using proper security.

If a page is requested using HTTP and the page is mapped as secure, a redirect using SSL will be performed.

Parameters:
requestId - The request id.

mvc\sacs\ZMSacsManager.php at line 261

getDefaultMapping

public array getDefaultMapping()

Get the default mapping.

Returns:
Default mapping data.

mvc\sacs\ZMSacsManager.php at line 191

getMappingValue

public mixed getMappingValue(string requestId, string key, mixed default)

Get mapping value.

Parameters:
requestId - The request id.
key - The mapping key.
default - The mapping key.
Returns:
The value or the provided default value; default is null.

mvc\sacs\ZMSacsManager.php at line 252

getMappings

public array getMappings()

Get all mapped requests.

Returns:
Map with requestId as key and sacs data as value.

mvc\sacs\ZMSacsManager.php at line 243

hasMappingForRequestId

public boolean hasMappingForRequestId(string requestId)

Check if a mapping for the given requestId exists.

Parameters:
requestId - The request id.
Returns:
true if a mapping exists, false if not.

mvc\sacs\ZMSacsManager.php at line 70

instance

public static void instance()

Get instance.


mvc\sacs\ZMSacsManager.php at line 95

load

public void load(string yaml, boolean override)

Load mappings from a YAML style string.

Parameters:
yaml - The yaml style mappings.
override - Optional flag to control whether to override existing mappings or to merge; default is true to override.

mvc\sacs\ZMSacsManager.php at line 233

requiresSecurity

public boolean requiresSecurity(string requestId)

Check if a request to the given page [name] is required to be secure.

Parameters:
requestId - The request id.
Returns:
true if a secure conenction is required.

mvc\sacs\ZMSacsManager.php at line 78

reset

public void reset()

Reset all internal data structures.


mvc\sacs\ZMSacsManager.php at line 118

setMapping

public void setMapping(string requestId, mixed authentication, boolean secure, array args)

Set a mapping.

The authentication value depends on the acutal handler implementation and is passed through as-is.

Parameters:
requestId - The request id [ie. the request name as set via the ZM_PAGE_KEY URL parameter].
authentication - The level of authentication required; default is null.
secure - Mark resource as secure; default is true.
args - Optional additional parameter map; default is an empty array.

ZenMagick 0.9.10