Esempio n. 1
0
 /**
  * Check for pre share requirements for group shares
  *
  * @param IShare $share
  * @throws \Exception
  */
 protected function groupCreateChecks(IShare $share)
 {
     // Verify if the user can share with this group
     if ($this->shareWithGroupMembersOnly()) {
         if (!$share->getSharedWith()->inGroup($share->getSharedBy())) {
             throw new \Exception('Only sharing within your own groups is allowed');
         }
     }
     /*
      * TODO: Could be costly, fix
      *
      * Also this is not what we want in the future.. then we want to squash identical shares.
      */
     $existingShares = $this->defaultProvider->getSharesByPath($share->getPath());
     foreach ($existingShares as $existingShare) {
         if ($existingShare->getSharedWith() === $share->getSharedWith()) {
             throw new \Exception('Path already shared with this group');
         }
     }
 }