Exemplo n.º 1
0
 /**
  * Try to login a user, assuming authentication
  * has already happened (e.g. via Single Sign On).
  *
  * Log in a user and regenerate a new session.
  *
  * @param \OCP\Authentication\IApacheBackend $backend
  * @return bool
  */
 public static function loginWithApache(\OCP\Authentication\IApacheBackend $backend)
 {
     $uid = $backend->getCurrentUserId();
     $run = true;
     OC_Hook::emit("OC_User", "pre_login", array("run" => &$run, "uid" => $uid));
     if ($uid) {
         if (self::getUser() !== $uid) {
             self::setUserId($uid);
             self::setDisplayName($uid);
             self::getUserSession()->setLoginName($uid);
             OC_Hook::emit("OC_User", "post_login", array("uid" => $uid, 'password' => ''));
         }
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * Try to login a user, assuming authentication
  * has already happened (e.g. via Single Sign On).
  *
  * Log in a user and regenerate a new session.
  *
  * @param \OCP\Authentication\IApacheBackend $backend
  * @return bool
  */
 public static function loginWithApache(\OCP\Authentication\IApacheBackend $backend)
 {
     $uid = $backend->getCurrentUserId();
     $run = true;
     OC_Hook::emit("OC_User", "pre_login", array("run" => &$run, "uid" => $uid));
     if ($uid) {
         if (self::getUser() !== $uid) {
             self::setUserId($uid);
             self::setDisplayName($uid);
             self::getUserSession()->setLoginName($uid);
             // setup the filesystem
             OC_Util::setupFS($uid);
             // first call the post_login hooks, the login-process needs to be
             // completed before we can safely create the users folder.
             // For example encryption needs to initialize the users keys first
             // before we can create the user folder with the skeleton files
             OC_Hook::emit("OC_User", "post_login", array("uid" => $uid, 'password' => ''));
             //trigger creation of user home and /files folder
             \OC::$server->getUserFolder($uid);
         }
         return true;
     }
     return false;
 }