Ingo::getUser PHP Method

getUser() public static method

Returns the user whose rules are currently being edited.
public static getUser ( boolean $full = true ) : string
$full boolean Always return the full user name with realm?
return string The current user.
    public static function getUser($full = true)
    {
        global $injector, $registry, $session;
        if (!$injector->getInstance('Ingo_Shares')) {
            return $registry->getAuth($full ? null : 'bare');
        }
        list(, $user) = explode(':', $session->get('ingo', 'current_share'), 2);
        return $user;
    }

Usage Example

示例#1
0
文件: Transport.php 项目: horde/horde
 /**
  * Returns a Ingo_Transport instance.
  *
  * @param array $transport  A transport driver name and parameter hash.
  *
  * @return Ingo_Transport  The Ingo_Transport instance.
  * @throws Ingo_Exception
  */
 public function create(array $transport)
 {
     global $registry;
     /* Get authentication parameters. */
     try {
         $auth = $GLOBALS['injector']->getInstance('Horde_Core_Hooks')->callHook('transport_auth', 'ingo', array($transport['driver']));
     } catch (Horde_Exception_HookNotSet $e) {
         $auth = null;
     }
     if (!is_array($auth)) {
         $auth = array();
     }
     if (!isset($auth['password'])) {
         $auth['password'] = $registry->getAuthCredential('password');
     }
     if (!isset($auth['username'])) {
         $auth['username'] = $registry->getAuth('bare');
     }
     if (!isset($auth['euser'])) {
         $auth['euser'] = Ingo::getUser(false);
     }
     $class = 'Ingo_Transport_' . ucfirst($transport['driver']);
     if (class_exists($class)) {
         return new $class(array_merge($auth, $transport['params']));
     }
     throw new Ingo_Exception(sprintf(_("Unable to load the transport driver \"%s\"."), $class));
 }
All Usage Examples Of Ingo::getUser