|
|
@@ -645,6 +645,16 @@ class ShareAPIController extends OCSController { |
|
|
|
$share = $this->setShareAttributes($share, $attributes); |
|
|
|
} |
|
|
|
|
|
|
|
//Expire date |
|
|
|
if ($expireDate !== '') { |
|
|
|
try { |
|
|
|
$expireDate = $this->parseDate($expireDate); |
|
|
|
$share->setExpirationDate($expireDate); |
|
|
|
} catch (\Exception $e) { |
|
|
|
throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$share->setSharedBy($this->currentUser); |
|
|
|
$this->checkInheritedAttributes($share); |
|
|
|
|
|
|
@@ -731,15 +741,6 @@ class ShareAPIController extends OCSController { |
|
|
|
|
|
|
|
$share->setSharedWith($shareWith); |
|
|
|
$share->setPermissions($permissions); |
|
|
|
if ($expireDate !== '') { |
|
|
|
try { |
|
|
|
$expireDate = $this->parseDate($expireDate); |
|
|
|
$share->setExpirationDate($expireDate); |
|
|
|
} catch (\Exception $e) { |
|
|
|
throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$share->setSharedWithDisplayName($this->getCachedFederatedDisplayName($shareWith, false)); |
|
|
|
} elseif ($shareType === IShare::TYPE_REMOTE_GROUP) { |
|
|
|
if (!$this->shareManager->outgoingServer2ServerGroupSharesAllowed()) { |
|
|
@@ -752,14 +753,6 @@ class ShareAPIController extends OCSController { |
|
|
|
|
|
|
|
$share->setSharedWith($shareWith); |
|
|
|
$share->setPermissions($permissions); |
|
|
|
if ($expireDate !== '') { |
|
|
|
try { |
|
|
|
$expireDate = $this->parseDate($expireDate); |
|
|
|
$share->setExpirationDate($expireDate); |
|
|
|
} catch (\Exception $e) { |
|
|
|
throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD')); |
|
|
|
} |
|
|
|
} |
|
|
|
} elseif ($shareType === IShare::TYPE_CIRCLE) { |
|
|
|
if (!\OC::$server->getAppManager()->isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) { |
|
|
|
throw new OCSNotFoundException($this->l->t('You cannot share to a Circle if the app is not enabled')); |
|
|
@@ -795,16 +788,6 @@ class ShareAPIController extends OCSController { |
|
|
|
throw new OCSBadRequestException($this->l->t('Unknown share type')); |
|
|
|
} |
|
|
|
|
|
|
|
//Expire date |
|
|
|
if ($expireDate !== '') { |
|
|
|
try { |
|
|
|
$expireDate = $this->parseDate($expireDate); |
|
|
|
$share->setExpirationDate($expireDate); |
|
|
|
} catch (\Exception $e) { |
|
|
|
throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$share->setShareType($shareType); |
|
|
|
|
|
|
|
if ($note !== '') { |