Пример #1
0
function removeUser($permId)
{
    global $auth, $perm;
    if (is_object($auth) && is_object($perm)) {
        $authData = $perm->getAuthUserId($permId);
        if (LiveUser::isError($authData)) {
            return $authData;
        }
        $result = $auth->removeUser($authData['auth_user_id']);
        if (LiveUser::isError($result)) {
            return $result;
        }
        return $perm->removeUser($permId);
    }
    return FALSE;
}
Пример #2
0
 /**
  * Return a textual error message for a LiveUser error code.
  *
  * @access  public
  * @param   int     error code
  * @return  string  error message
  */
 function errorMessage($value)
 {
     // make the variable static so that it only has to do the defining on the first call
     static $errorMessages;
     // define the varies error messages
     if (!isset($errorMessages)) {
         $errorMessages = array(LIVEUSER_ERROR => 'Unknown error', LIVEUSER_ERROR_NOT_SUPPORTED => 'Feature not supported', LIVEUSER_ERROR_CONFIG => 'Config file error', LIVEUSER_ERROR_MISSING_DEPS => 'Missing package depedencies', LIVEUSER_ERROR_MISSING_LOGINFUNCTION => 'Login function not found', LIVEUSER_ERROR_MISSING_LOGOUTFUNCTION => 'Logout function not found', LIVEUSER_ERROR_COOKIE => 'Remember Me cookie error', LIVEUSER_STATUS_EXPIRED => 'User session has expired', LIVEUSER_STATUS_ISINACTIVE => 'User is set to inactive', LIVEUSER_STATUS_PERMINITERROR => 'Cannot instantiate permission container', LIVEUSER_STATUS_AUTHINITERROR => 'Cannot instantiate authentication configuration', LIVEUSER_STATUS_AUTHNOTFOUND => 'Cannot retrieve Auth object from session', LIVEUSER_STATUS_UNKNOWN => 'Something went wrong in whatever you were trying to do', LIVEUSER_STATUS_LOGGEDOUT => 'User was logged out correctly');
     }
     // If this is an error object, then grab the corresponding error code
     if (LiveUser::isError($value)) {
         $value = $value->getCode();
     }
     // return the textual error message corresponding to the code
     return isset($errorMessages[$value]) ? $errorMessages[$value] : $errorMessages[LIVEUSER_ERROR];
 }
Пример #3
0
 /**
  * Finds and gets userinfo by his userID, customFields can
  *  also be gotten
  *
  * Untested: it most likely doesn't work.
  *
  * @access public
  * @param mixed User ID
  * @param   array  custom fields you want to be returned. If not specified
  *                 the basic set of fields is returned. The keys are the
  *                 names and the values
  * @return mixed Array with userinfo if found else error object
  */
 function getUser($userId, $customFields = array())
 {
     if (is_object($this->auth) && is_object($this->perm)) {
         if (is_array($this->auth->authTableCols['user_id'])) {
             $user_auth_id = $this->auth->authTableCols['user_id']['name'];
             $type = $this->auth->authTableCols['user_id']['type'];
         } else {
             $user_auth_id = $this->auth->authTableCols['user_id'];
             $type = '';
         }
         $filters = array($user_auth_id => array('op' => '=', 'value' => $userId, 'cond' => '', 'type' => $type));
         $search = $this->auth->getUsers($filters, $customFields);
         if (LiveUser::isError($search)) {
             return $search;
         }
         return $search;
     }
     return LiveUser::raiseError(LIVEUSER_ERROR, null, null, 'Perm or Auth container couldn\\t be started.');
 }
Пример #4
0
 /**
  * Return a textual error message for a LiveUser error code.
  *
  * @access  public
  * @param   mixed   error code or error object
  * @return  string  error message
  */
 function errorMessage($value)
 {
     // make the variable static so that it only has to do the defining on the first call
     static $errorMessages;
     // define the varies error messages
     if (!isset($errorMessages)) {
         $errorMessages = array(LIVEUSER_ERROR => 'Unknown error', LIVEUSER_ERROR_NOT_SUPPORTED => 'Feature not supported', LIVEUSER_ERROR_CONFIG => 'Config file error', LIVEUSER_ERROR_MISSING_DEPS => 'Missing package depedencies', LIVEUSER_ERROR_MISSING_LOGINFUNCTION => 'Login function not found', LIVEUSER_ERROR_MISSING_LOGOUTFUNCTION => 'Logout function not found', LIVEUSER_ERROR_COOKIE => 'Remember Me cookie error');
     }
     // If this is an error object, then grab the corresponding error code
     if (LiveUser::isError($value)) {
         $value = $value->getCode();
     }
     // return the textual error message corresponding to the code
     return isset($errorMessages[$value]) ? $errorMessages[$value] : $errorMessages[LIVEUSER_ERROR];
 }
Пример #5
0
 /**
  * Finds and gets userinfo by his userID, customFields can
  *  also be gotten
  *
  * Untested: it most likely doesn't work.
  *
  * @access public
  * @param  mixed  Perm User ID
  * @return mixed Array with userinfo if found else error object
  */
 function getUser($permId)
 {
     if (is_object($this->auth) && is_object($this->perm)) {
         $user_auth_id = $this->auth->authTableCols['required']['auth_user_id']['name'];
         $type = isset($this->auth->authTableCols['required']['auth_user_id']['type']) ? $this->auth->authTableCols['required']['auth_user_id']['type'] : '';
         $authData = $this->perm->getAuthUserId($permId);
         $filters = array($user_auth_id => array('name' => $user_auth_id, 'op' => '=', 'value' => $authData['auth_user_id'], 'cond' => '', 'type' => $type));
         $search = $this->auth->getUsers($filters);
         if (LiveUser::isError($search)) {
             return $search;
         }
         return $search;
     }
     return LiveUser::raiseError(LIVEUSER_ERROR, null, null, 'Perm or Auth container couldn\\t be started.');
 }