An access control object

English | 日本語

Stagehand_AccessControl provides an object for access control. You can specify rules to allow access and deny access, evaluate the target such like the following:

$denyAllow = Stagehand_AccessControl::denyAllow();
$denyAllow->deny('^192\.168\.0\.1$');
if ($denyAllow->evaluate('192.168.0.1') == Stagehand_AccessControl_AccessState::ALLOW) {
    // access granted
    ...
} else {
    // access denied
    ...
}

The evaluation process works like access control by the Order directive of Apache. Stagehand_AccessControl::denyAllow() creates an object corresponding to Deny,Allow of Apache, and Stagehand_AccessControl::allowDeny() creates an object corresponding to Allow,Deny.

Since the evaluation is done by a matcher, the evaluation logic can be changed by replacing the matcher with another. The default is RegexMatcher which matches by regular expressions.

Features

  • Evaluates whether the target matches with the given rules or not.
  • Apache like evaluation logic and orders.
  • Built-in matchers. (RegexMatcher and EqualMatcher)
  • Can specify any matcher.

Requirements

Installation

Package Version Stability Release Date License
Stagehand_AccessControl 1.0.0 stable 2010-09-09 New BSD License Release Notes

Stagehand_AccessControl can be installed directly using our PEAR channel pear.piece-framework.com. The following is a basic installation:

pear channel-discover pear.piece-framework.com
pear install piece/stagehand_accesscontrol

Documentation

Source

Browse Source Code

Browse Source Code

Git Access

git clone git://github.com/piece/stagehand-accesscontrol.git