fogproject  1.5.9
About: FOG is a Linux-based network computer cloning solution for Windows, Mac OSX and various Linux distributions that ties together a few open-source tools with a PHP-based web interface. FOG doesn’t use any boot disks, or CDs; everything is done via TFTP and PXE.
  Fossies Dox: fogproject-1.5.9.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

accesscontrol.class.php
Go to the documentation of this file.
1 <?php
23 {
29  protected $databaseTable = 'roles';
35  protected $databaseFields = array(
36  'id' => 'rID',
37  'name' => 'rName',
38  'description' => 'rDesc',
39  'createdBy' => 'rCreatedBy',
40  'createdTime' => 'rCreatedTime',
41  );
47  protected $databaseFieldsRequired = array(
48  'name',
49  );
55  protected $additionalFields = array(
56  'description',
57  'users',
58  'usersnotinme',
59  'accesscontrolrules',
60  'accesscontrolrulesnotinme',
61  );
69  public function addUser($addArray)
70  {
71  return $this->addRemItem(
72  'users',
73  (array)$addArray,
74  'merge'
75  );
76  }
84  public function removeUser($removeArray)
85  {
86  return $this->addRemItem(
87  'users',
88  (array)$removeArray,
89  'diff'
90  );
91  }
99  public function addRule($addArray)
100  {
101  return $this->addRemItem(
102  'accesscontrolrules',
103  (array)$addArray,
104  'merge'
105  );
106  }
114  public function removeRule($removeArray)
115  {
116  return $this->addRemItem(
117  'accesscontrolrules',
118  (array)$removeArray,
119  'diff'
120  );
121  }
127  public function save()
128  {
129  parent::save();
130  return $this
131  ->assocSetter('AccessControl', 'user')
132  ->assocSetter('AccessControlRule', 'accesscontrolrule')
133  ->load();
134  }
140  protected function loadUsers()
141  {
142  $associds = self::getSubObjectIDs(
143  'AccessControlAssociation',
144  array('accesscontrolID' => $this->get('id')),
145  'userID'
146  );
147  $types = array();
148  self::$HookManager->processEvent(
149  'USER_TYPES_FILTER',
150  array('types' => &$types)
151  );
152  $userid = self::getSubObjectIDs(
153  'User',
154  array('type' => $types)
155  );
156  $associds = array_diff(
157  $associds,
158  $userid
159  );
160  unset($userid);
161  $userids = self::getSubObjectIDs(
162  'User',
163  array('id' => $associds)
164  );
165  $this->set('users', (array)$userids);
166  }
172  protected function loadUsersnotinme()
173  {
174  $find = array('id' => $this->get('users'));
175  $userids = array_diff(
176  self::getSubObjectIDs('User'),
177  $this->get('users')
178  );
179  $types = array();
180  self::$HookManager->processEvent(
181  'USER_TYPES_FILTER',
182  array('types' => &$types)
183  );
184  $users = array();
185  foreach ((array)self::getClass('UserManager')
186  ->find(array('id' => $userids)) as &$User
187  ) {
188  if (in_array($User->get('type'), $types)) {
189  continue;
190  }
191  $users[] = $User->get('id');
192  unset($User);
193  }
194  unset($userids, $types);
195  $this->set('usersnotinme', (array)$users);
196  unset($users);
197  }
203  protected function loadAccesscontrolrules()
204  {
205  $associds = self::getSubObjectIDs(
206  'AccessControlRuleAssociation',
207  array('accesscontrolID' => $this->get('id')),
208  'accesscontrolruleID'
209  );
210  $ruleids = self::getSubObjectIDs(
211  'AccessControlRule',
212  array('id' => $associds)
213  );
214  $this->set('accesscontrolrules', (array)$ruleids);
215  }
221  protected function loadAccesscontrolrulesnotinme()
222  {
223  $rules = array_diff(
224  self::getSubObjectIDs('AccessControlRule'),
225  $this->get('accesscontrolrules')
226  );
227  $this->set('accesscontrolrulesnotinme', (array)$rules);
228  }
229 }
AccessControl\loadAccesscontrolrules
loadAccesscontrolrules()
Definition: accesscontrol.class.php:203
FOGController\addRemItem
addRemItem($key, $array, $array_type)
Definition: fogcontroller.class.php:823
AccessControl\$databaseFields
$databaseFields
Definition: accesscontrol.class.php:35
AccessControl\$databaseTable
$databaseTable
Definition: accesscontrol.class.php:29
AccessControl\loadUsers
loadUsers()
Definition: accesscontrol.class.php:140
AccessControl
Definition: accesscontrol.class.php:23
AccessControl\$additionalFields
$additionalFields
Definition: accesscontrol.class.php:55
AccessControl\$databaseFieldsRequired
$databaseFieldsRequired
Definition: accesscontrol.class.php:47
AccessControl\addUser
addUser($addArray)
Definition: accesscontrol.class.php:69
AccessControl\loadUsersnotinme
loadUsersnotinme()
Definition: accesscontrol.class.php:172
FOGController
Definition: fogcontroller.class.php:29
AccessControl\loadAccesscontrolrulesnotinme
loadAccesscontrolrulesnotinme()
Definition: accesscontrol.class.php:221
FOGBase\getSubObjectIDs
static getSubObjectIDs( $object='Host', $findWhere=array(), $getField='id', $not=false, $operator='AND', $orderBy='name', $groupBy=false, $filter='array_unique')
Definition: fogbase.class.php:2006
AccessControl\removeRule
removeRule($removeArray)
Definition: accesscontrol.class.php:114
AccessControl\removeUser
removeUser($removeArray)
Definition: accesscontrol.class.php:84
AccessControl\save
save()
Definition: accesscontrol.class.php:127
AccessControl\addRule
addRule($addArray)
Definition: accesscontrol.class.php:99