Add expiration date field in UI.
Save expiration date when creating or updating federated share.
Read expiration date from DB in federated share provider.
Applies to both federated user and group shares.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
@ -587,15 +587,39 @@ class ShareAPIController extends OCSController {
thrownewOCSForbiddenException($this->l->t('Sharing %1$s failed because the back end does not allow shares from type %2$s',[$path->getPath(),$shareType]));
}
if($shareWith===null){
thrownewOCSNotFoundException($this->l->t('Please specify a valid federated user id'));
}
$share->setSharedWith($shareWith);
$share->setPermissions($permissions);
if($expireDate!==''){
try{
$expireDate=$this->parseDate($expireDate);
$share->setExpirationDate($expireDate);
}catch(\Exception$e){
thrownewOCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD'));
thrownewOCSForbiddenException($this->l->t('Sharing %1$s failed because the back end does not allow shares from type %2$s',[$path->getPath(),$shareType]));
}
if($shareWith===null){
thrownewOCSNotFoundException($this->l->t('Please specify a valid federated group id'));
}
$share->setSharedWith($shareWith);
$share->setPermissions($permissions);
if($expireDate!==''){
try{
$expireDate=$this->parseDate($expireDate);
$share->setExpirationDate($expireDate);
}catch(\Exception$e){
thrownewOCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD'));