## Class TAuthorizationRule

Description

TAuthorizationRule class

TAuthorizationRule represents a single authorization rule. A rule is specified by an action (required), a list of users (optional), a list of roles (optional), a verb (optional), and a list of IP rules (optional). Action can be either 'allow' or 'deny'. Guest (anonymous, unauthenticated) users are represented by question mark '?'. All users (including guest users) are represented by asterisk '*'. Authenticated users are represented by '@'. Users/roles are case-insensitive. Different users/roles are separated by comma ','. Verb can be either 'get' or 'post'. If it is absent, it means both. IP rules are separated by comma ',' and can contain wild card in the rules (e.g. '192.132.23.33, 192.122.*.*')

- since: 3.0
- version: $Id: TAuthorizationRule.php 2294 2007-10-02 13:38:13Z xue $
- author: Qiang Xue <qiang.xue@gmail.com>

Located in /Security/TAuthorizationRule.php (line 32)

    TComponent
       |
       --TAuthorizationRule

Method Summary
TAuthorizationRule __construct (string $action, string $users, string $roles, [string $verb = ''], [string $ipRules = ''])
string getAction ()
boolean getAuthenticatedApplied ()
boolean getEveryoneApplied ()
boolean getGuestApplied ()
array getIPRules ()
array getRoles ()
array getUsers ()
string getVerb ()
integer isUserAllowed (IUser $user, string $verb, string $ip)
Methods
Constructor __construct (line 75)

Constructor.

- access: public

TAuthorizationRule __construct (string $action, string $users, string $roles, [string $verb = ''], [string $ipRules = ''])

- string $action: action, either 'deny' or 'allow'
- string $users: a comma separated user list
- string $roles: a comma separated role list
- string $verb: verb, can be empty, 'get', or 'post'
- string $ipRules: IP rules (separated by comma, can contain wild card *)

getAction (line 136)

- return: action, either 'allow' or 'deny'
- access: public

string getAction ()
getAuthenticatedApplied (line 193)

- return: if this rule applies to authenticated users
- access: public

boolean getAuthenticatedApplied ()
getEveryoneApplied (line 185)

- return: if this rule applies to everyone
- access: public

boolean getEveryoneApplied ()
getGuestApplied (line 177)

- return: if this rule applies to everyone
- access: public

boolean getGuestApplied ()
getIPRules (line 169)

- return: list of IP rules.
- access: public
- since: 3.1.1

array getIPRules ()
getRoles (line 152)

- return: list of roles
- access: public

array getRoles ()
getUsers (line 144)

- return: list of user IDs
- access: public

array getUsers ()
getVerb (line 160)

- return: verb, may be empty, 'get', or 'post'.
- access: public

string getVerb ()
isUserAllowed (line 204)

- return: 1 if the user is allowed, -1 if the user is denied, 0 if the rule does not apply to the user
- access: public

integer isUserAllowed (IUser $user, string $verb, string $ip)

- IUser $user: the user object
- string $verb: the request verb (GET, PUT)
- string $ip: the request IP address

#### Inherited Methods

Inherited From TComponent

> TComponent::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Documentation generated on Mon, 21 Apr 2008 11:30:42 -0400 by phpDocumentor 1.3.0RC4