Esempio n. 1
0
 /**
  * update password for public link share
  * @param int $shareId
  * @param int $shareType 
  * @param string $password
  * @return \OC_OCS_Result
  */
 private static function updatePassword($shareId, $shareType, $password)
 {
     if ($shareType !== \OCP\Share::SHARE_TYPE_LINK) {
         return new \OC_OCS_Result(null, 400, "password protection is only supported for public shares");
     }
     if ($password === '') {
         $password = null;
     }
     try {
         $result = \OCP\Share::setPassword($shareId, $password);
     } catch (\Exception $e) {
         return new \OC_OCS_Result(null, 403, $e->getMessage());
     }
     if ($result) {
         return new \OC_OCS_Result();
     }
     return new \OC_OCS_Result(null, 404, "couldn't set password");
 }