예제 #1
0
파일: manager.php 프로젝트: Pookay/core
 /**
  * Get the share by token possible with password
  *
  * @param string $token
  * @return Share
  *
  * @throws ShareNotFound
  */
 public function getShareByToken($token)
 {
     $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK);
     $share = $provider->getShareByToken($token);
     //TODO check if share expired
     return $share;
 }
예제 #2
0
 /**
  * Verify the password of a public share
  *
  * @param \OCP\Share\IShare $share
  * @param string $password
  * @return bool
  */
 public function checkPassword(\OCP\Share\IShare $share, $password)
 {
     if ($share->getShareType() !== \OCP\Share::SHARE_TYPE_LINK) {
         //TODO maybe exception?
         return false;
     }
     if ($password === null || $share->getPassword() === null) {
         return false;
     }
     $newHash = '';
     if (!$this->hasher->verify($password, $share->getPassword(), $newHash)) {
         return false;
     }
     if (!empty($newHash)) {
         $share->setPassword($newHash);
         $provider = $this->factory->getProviderForType($share->getShareType());
         $provider->update($share);
     }
     return true;
 }
예제 #3
0
 /**
  * @inheritdoc
  */
 public function userDeletedFromGroup($uid, $gid)
 {
     $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_GROUP);
     $provider->userDeletedFromGroup($uid, $gid);
 }