Class permissions

Description

The permissions class. This class encpasulates a set of permissions which can be managed and tested by the associated methods.

Located in /user-defs.php (line 616)


	
			
Variable Summary
 mixed $perms
Method Summary
 permissions permissions ([mixed $perms = false])
 boolean anypermitted (mixed $agentids, integer $perm, [string $delim = ","])
 boolean ispermitted (integer $agentid, integer $perm)
 integer permission (integer $agentid, integer $perm)
 void permit (mixed $agentids, integer $perm, [string $delim = ","])
 void setdefault (integer $perm)
 void unpermit (mixed $agentids, integer $perm, [string $delim = ","])
Variables
mixed $perms = array() (line 621)

Array of permisssions. This is an associative array with the

Methods
Constructor permissions (line 628)

Constructor Create a new permissions object with an optional permissions set.

permissions permissions ([mixed $perms = false])
  • mixed $perms: If provided, must be an array of permissions
anypermitted (line 724)

This is a variant permitted query method, which takes a comma-delimited list of agent IDs, and returns true if ANY one or more of these has the required permissions. This facilitates passing of a group membership list for a given user, for example.

  • return: True if the agent is permitted access in given ways
boolean anypermitted (mixed $agentids, integer $perm, [string $delim = ","])
  • mixed $agentids: Agents to query the permission of (array or delimited string)
  • integer $perm: The access permission
  • string $delim: Delimiter character used (default is a comma)
ispermitted (line 706)

This is the main method for querying permission access rights for a given agent. Returns a boolean value, true if the agent is permitted to access in the given way, else false. If the agent ID is unrecognised, then the method uses the 'default agent' permissions.

  • return: True if the agent is permitted access in given ways
boolean ispermitted (integer $agentid, integer $perm)
  • integer $agentid: The agent to query the access permission of
  • integer $perm: The access permission
permission (line 688)

Low-level method for returning the permission for the given agent and perm. We return one of three states: agent is allowed, agent is disallowed, or agent permission status is undefined/unknown. The latter would occur if the agent ID is unrecognised in this class (ie. not in the $perms array).

  • return: The permission status: allowed, disallowed or undefined
integer permission (integer $agentid, integer $perm)
  • integer $agentid: The unique agent ID to return the permission of
  • integer $perm: The permission of combination of perms to assign
permit (line 652)

Assign the given agent(s) the given access permission. The first paramter is a (comma) delimited list of agent IDs to assign the permission to.

void permit (mixed $agentids, integer $perm, [string $delim = ","])
  • mixed $agentids: Agents to assign the permission to (array or delimited string)
  • integer $perm: The permission of combination of perms to assign
  • string $delim: The delimiter string separating agent IDs (default comma)
setdefault (line 641)

Assign the default permission. This is the permission which is applied if the supplied agent is not recognised.

void setdefault (integer $perm)
  • integer $perm: The default permission to apply for unrecognised agents
unpermit (line 667)

Un-assign the given agent(s) the given access permission. The first paramter is a (comma) delimited list of agent IDs to unassign the permission from.

void unpermit (mixed $agentids, integer $perm, [string $delim = ","])
  • mixed $agentids: Agents to unassign the permission from (array or delimited string)
  • integer $perm: The permission of combination of perms to unassign
  • string $delim: The delimiter string separating agent IDs (default comma)

Documentation generated by phpDocumentor 1.3.0RC3