Exemplo n.º 1
0
 public function switchActions($actionName, $httpVars, $fileVars)
 {
     switch ($actionName) {
         case "accept_invitation":
             $remoteShareId = \AJXP_Utils::sanitize($httpVars["remote_share_id"], AJXP_SANITIZE_ALPHANUM);
             $store = new SQLStore();
             $remoteShare = $store->remoteShareById($remoteShareId);
             if ($remoteShare !== null) {
                 $client = new OCSClient();
                 $client->acceptInvitation($remoteShare);
                 $remoteShare->setStatus(OCS_INVITATION_STATUS_ACCEPTED);
                 $store->storeRemoteShare($remoteShare);
             }
             break;
         case "reject_invitation":
             $remoteShareId = \AJXP_Utils::sanitize($httpVars["remote_share_id"], AJXP_SANITIZE_ALPHANUM);
             $store = new SQLStore();
             $remoteShare = $store->remoteShareById($remoteShareId);
             if ($remoteShare !== null) {
                 $client = new OCSClient();
                 $client->declineInvitation($remoteShare);
                 $store->deleteRemoteShare($remoteShare);
                 \ConfService::getInstance()->invalidateLoadedRepositories();
             }
             break;
         default:
             break;
     }
     return null;
 }
Exemplo n.º 2
0
 public function remoteRepositoryById($repositoryId, &$repoObject)
 {
     if (strpos($repositoryId, "ocs_remote_share_") !== 0) {
         return;
     }
     $store = new Model\SQLStore();
     $remoteShareId = str_replace("ocs_remote_share_", "", $repositoryId);
     $share = $store->remoteShareById($remoteShareId);
     if ($share != null) {
         $repoObject = $share->buildVirtualRepository();
         $loggedUser = \AuthService::getLoggedUser();
         if ($loggedUser != null) {
             $loggedUser->personalRole->setAcl($repoObject->getId(), "rw");
             $loggedUser->recomputeMergedRole();
             \AuthService::updateUser($loggedUser);
         }
     }
 }