Пример #1
0
 /**
  * Finds and gets full userinfo by filtering inside the auth container
  *
  * @param  array auth params (as for getUsers() from the auth container
  * @return array|bool Array with userinfo if found on success or false otherwise
  *
  * @access private
  */
 function _getUsersByAuth($authParams = array())
 {
     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;
     }
     $first = $authParams['select'] == 'row';
     $authUsers = $this->auth->getUsers($authParams);
     if (!$authUsers) {
         return $authUsers;
     }
     if ($first) {
         $authUsers = array($authUsers);
     }
     $users = array();
     foreach ($authUsers as $authData) {
         $permParams = array('filters' => array('auth_user_id' => $authData['auth_user_id'], 'auth_container_name' => $this->authContainerName), 'select' => 'row');
         $permData = $this->perm->getUsers($permParams);
         if (!$permData) {
             continue;
         }
         if ($first) {
             return LiveUser::arrayMergeClobber($authData, $permData);
         }
         $users[] = LiveUser::arrayMergeClobber($authData, $permData);
     }
     return $users;
 }
Пример #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);
 }