Hoa central
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Hoa\Acl\Group Class Reference
Inheritance diagram for Hoa\Acl\Group:

Public Member Functions

 __construct ($id, $label=null)
 
 addPermission ($permissions=[])
 
 deletePermission ($permissions=[])
 
 permissionExists ($permissionId)
 
 getPermissions ()
 
 setLabel ($label)
 
 getId ()
 
 getLabel ()
 
 getNodeId ()
 

Protected Member Functions

 setId ($id)
 

Protected Attributes

 $groupId = null
 
 $groupLabel = null
 
 $permissions = []
 

Detailed Description

Class .

Describe a group. A group is based on a graph (coding by adjacency list) to set up the multi-inheritance of the group.

Definition at line 50 of file Group.php.

Constructor & Destructor Documentation

Hoa\Acl\Group::__construct (   $id,
  $label = null 
)

Built a new group.

Parameters
mixed$idThe group ID.
string$labelThe group label.
Returns
void

Definition at line 82 of file Group.php.

83  {
84  $this->setId($id);
85  $this->setLabel($label);
86 
87  return;
88  }
setId($id)
Definition: Group.php:177
setLabel($label)
Definition: Group.php:191

Here is the call graph for this function:

Member Function Documentation

Hoa\Acl\Group::addPermission (   $permissions = [])

Add permission.

Parameters
array$permissionsPermission to add.
Returns
array
Exceptions

Definition at line 97 of file Group.php.

98  {
99  if (!is_array($permissions)) {
101  }
102 
103  foreach ($permissions as $permission) {
104  if (!($permission instanceof Permission)) {
105  throw new Exception(
106  'Permission %s must be an instance of \Hoa\Acl\Permission',
107  0,
108  $permission
109  );
110  }
111 
112  if (true === $this->permissionExists($permission->getId())) {
113  continue;
114  }
115 
116  $this->permissions[$permission->getId()] = $permission;
117  }
118 
119  return $this->getPermissions();
120  }
getPermissions()
Definition: Group.php:166
permissionExists($permissionId)
Definition: Group.php:156

Here is the call graph for this function:

Hoa\Acl\Group::deletePermission (   $permissions = [])

Delete permission.

Parameters
array$permissionsPermission to add.
Returns
array
Exceptions

Definition at line 129 of file Group.php.

130  {
131  if (!is_array($permissions)) {
133  }
134 
135  foreach ($permissions as $permission) {
136  if ($permission instanceof Permission) {
137  $permission = $permission->getId();
138  }
139 
140  if (false === $this->permissionExists($permission)) {
141  continue;
142  }
143 
144  unset($this->permissions[$permission]);
145  }
146 
147  return $this->getPermissions();
148  }
getPermissions()
Definition: Group.php:166
permissionExists($permissionId)
Definition: Group.php:156

Here is the call graph for this function:

Hoa\Acl\Group::getId ( )

Get group ID.

Returns
mixed

Definition at line 204 of file Group.php.

205  {
206  return $this->groupId;
207  }

Here is the caller graph for this function:

Hoa\Acl\Group::getLabel ( )

Get group label.

Returns
mixed

Definition at line 214 of file Group.php.

215  {
216  return $this->groupLabel;
217  }
Hoa\Acl\Group::getNodeId ( )

Get node ID, i.e. group ID as well (see ).

Returns
mixed

Implements Hoa\Graph\IGraph\Node.

Definition at line 225 of file Group.php.

226  {
227  return $this->getId();
228  }

Here is the call graph for this function:

Hoa\Acl\Group::getPermissions ( )

Get all permissions, i.e. the permissions collection.

Returns
array

Definition at line 166 of file Group.php.

167  {
168  return $this->permissions;
169  }

Here is the caller graph for this function:

Hoa\Acl\Group::permissionExists (   $permissionId)

Check if a permission exists.

Parameters
mixed$permissionIdThe permission ID.
Returns
bool

Definition at line 156 of file Group.php.

157  {
158  return isset($this->permissions[$permissionId]);
159  }

Here is the caller graph for this function:

Hoa\Acl\Group::setId (   $id)
protected

Set group ID.

Parameters
mixed$idThe group ID.
Returns
mixed

Definition at line 177 of file Group.php.

178  {
179  $old = $this->groupId;
180  $this->groupId = $id;
181 
182  return $old;
183  }

Here is the caller graph for this function:

Hoa\Acl\Group::setLabel (   $label)

Set group label.

Parameters
string$labelThe group label.
Returns
string

Definition at line 191 of file Group.php.

192  {
193  $old = $this->groupLabel;
194  $this->groupLabel = $label;
195 
196  return $old;
197  }

Here is the caller graph for this function:

Member Data Documentation

Hoa\Acl\Group::$groupId = null
protected

Definition at line 57 of file Group.php.

Hoa\Acl\Group::$groupLabel = null
protected

Definition at line 64 of file Group.php.

Hoa\Acl\Group::$permissions = []
protected

Definition at line 71 of file Group.php.


The documentation for this class was generated from the following file: