## 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), and a verb (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 '*'. 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.

- since: 3.0
- version: $Id: TAuthorizationRule.php 1436 2006-09-23 01:51:57Z xue $
- author: Qiang Xue <qiang.xue@gmail.com>

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

    TComponent
       |
       --TAuthorizationRule

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

Constructor.

- access: public

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

- 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'

getAction (line 105)

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

string getAction ()
getEveryoneApplied (line 145)

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

boolean getEveryoneApplied ()
getGuestApplied (line 137)

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

boolean getGuestApplied ()
getRoles (line 121)

- return: list of roles
- access: public

array getRoles ()
getUsers (line 113)

- return: list of user IDs
- access: public

array getUsers ()
getVerb (line 129)

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

string getVerb ()
isUserAllowed (line 153)

- 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, mixed $verb)

#### 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 Sun, 14 Jan 2007 21:41:08 -0500 by phpDocumentor 1.3.0RC4