Пример #1
0
 /**
  * Removes user from both Perm and Auth containers
  *
  * @param int Perm ID
  * @return int|bool affected rows on success or false otherwise
  *
  * @access public
  */
 function removeUser($permUserId)
 {
     if (!is_object($this->auth) || !is_object($this->perm)) {
         $this->stack->push(LIVEUSER_ADMIN_ERROR, 'exception', array('msg' => 'Perm and/or Auth container not set.'));
         return false;
     }
     $permData = $this->perm->getUsers(array('fields' => array('auth_user_id', 'auth_container_name'), 'filters' => array('perm_user_id' => $permUserId), 'select' => 'row'));
     if (!$permData) {
         $this->stack->push(LIVEUSER_ADMIN_ERROR, 'exception', array('msg' => 'Could not find user in the permission backend'));
         return false;
     }
     $filters = array('perm_user_id' => $permUserId);
     $result = $this->perm->removeUser($filters);
     if ($result === false) {
         return false;
     }
     $this->setAdminAuthContainer($permData['auth_container_name']);
     $filters = array('auth_user_id' => $permData['auth_user_id']);
     return $this->auth->removeUser($filters);
 }
Пример #2
0
 /**
  * Remove users and all their relevant relations
  *
  * @param array key values pairs (value may be a string or an array)
  *                      This will construct the WHERE clause of your update
  *                      Be careful, if you leave this blank no WHERE clause
  *                      will be used and all users will be affected by the removed
  * @return int|bool false on error, the affected rows on success
  *
  * @access public
  */
 function removeUser($filters)
 {
     // Prepare the filters. Based on the provided filters a new array will be
     // created with the corresponding perm_user_id's. If the filters are empty,
     // cause an error or just have no result 0 or false will be returned
     $filters = $this->_makeRemoveFilter($filters, 'perm_user_id', 'getUsers');
     if (!$filters) {
         return $filters;
     }
     // Remove the users from any group it might be a member of.
     // If an error occures, return false.
     $result = $this->removeUserFromGroup($filters);
     if ($result === false) {
         return false;
     }
     // remove the user using Perm Simple.
     return parent::removeUser($filters);
 }