mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 19:03:14 +01:00
implement missed shareExpiration and sharePassword attributes when sending mail
This commit is contained in:
parent
52a28b40bc
commit
fe57e18438
@ -46,7 +46,7 @@ The content of the POST request is a JSON encoded object with following attribut
|
|||||||
- "link" send as sharing link
|
- "link" send as sharing link
|
||||||
- "share_ro" send a readonly share using the current file content (VFS only)
|
- "share_ro" send a readonly share using the current file content (VFS only)
|
||||||
- "share_rw" send as writable share (VFS and EPL only)
|
- "share_rw" send as writable share (VFS and EPL only)
|
||||||
- ```shareExpiration```: "yyyy-mm-dd", default not accessed in 100 days (EPL only)
|
- ```shareExpiration```: "yyyy-mm-dd" or e.g. "+2days", default not accessed in 100 days (EPL only)
|
||||||
- ```sharePassword```: string with password required to access share, default none (EPL only)
|
- ```sharePassword```: string with password required to access share, default none (EPL only)
|
||||||
- ```folder```: folder to store send mail, default Sent folder
|
- ```folder```: folder to store send mail, default Sent folder
|
||||||
- ```priority```: 1: high, 3: normal (default), 5: low
|
- ```priority```: 1: high, 3: normal (default), 5: low
|
||||||
|
@ -74,7 +74,8 @@ class ApiHandler extends Api\CalDAV\Handler
|
|||||||
'body' => $data['bodyHtml'] ?? null ?: $data['body'] ?? '',
|
'body' => $data['bodyHtml'] ?? null ?: $data['body'] ?? '',
|
||||||
'mimeType' => !empty($data['bodyHtml']) ? 'html' : 'plain',
|
'mimeType' => !empty($data['bodyHtml']) ? 'html' : 'plain',
|
||||||
'identity' => $ident_id,
|
'identity' => $ident_id,
|
||||||
]+self::prepareAttachments($data['attachments'] ?? [], $data['attachmentType'] ?? 'attach', $do_compose));
|
]+self::prepareAttachments($data['attachments'] ?? [], $data['attachmentType'] ?? 'attach',
|
||||||
|
$data['shareExpiration'], $data['sharePassword'], $do_compose));
|
||||||
|
|
||||||
// for compose we need to construct a URL and push it to the client (or give an error if the client is not online)
|
// for compose we need to construct a URL and push it to the client (or give an error if the client is not online)
|
||||||
if ($do_compose)
|
if ($do_compose)
|
||||||
@ -202,13 +203,22 @@ class ApiHandler extends Api\CalDAV\Handler
|
|||||||
/**
|
/**
|
||||||
* Convert an attachment name into an upload array for mail_compose::compose
|
* Convert an attachment name into an upload array for mail_compose::compose
|
||||||
*
|
*
|
||||||
* @param string[]? $attachments either "/mail/attachments/<token>" / file in temp_dir or VFS path
|
* @param string[] $attachments either "/mail/attachments/<token>" / file in temp_dir or VFS path
|
||||||
* @param string? $attachmentType "attach" (default), "link", "share_ro", "share_rw"
|
* @param ?string $attachmentType "attach" (default), "link", "share_ro", "share_rw"
|
||||||
|
* @param ?string $expiration "YYYY-mm-dd" or e.g. "+2days"
|
||||||
|
* @param ?string $password optional password for the share
|
||||||
* @param bool $compose true: for compose window, false: to send
|
* @param bool $compose true: for compose window, false: to send
|
||||||
* @return array with values for keys "file", "name" and "filemode"
|
* @return array with values for keys "file", "name", "filemode", "expiration" and "password"
|
||||||
* @throws Exception if file not found or unreadable
|
* @throws Exception if file not found or unreadable
|
||||||
*/
|
*/
|
||||||
protected static function prepareAttachments(array $attachments, string $attachmentType=null, bool $compose=true)
|
/**
|
||||||
|
* @param array $attachments
|
||||||
|
* @param string|null $attachmentType
|
||||||
|
* @param bool $compose
|
||||||
|
* @return array
|
||||||
|
* @throws Api\Exception
|
||||||
|
*/
|
||||||
|
protected static function prepareAttachments(array $attachments, string $attachmentType=null, string $expiration=null, string $password=null, bool $compose=true)
|
||||||
{
|
{
|
||||||
$ret = [];
|
$ret = [];
|
||||||
foreach($attachments as $attachment)
|
foreach($attachments as $attachment)
|
||||||
@ -263,6 +273,12 @@ class ApiHandler extends Api\CalDAV\Handler
|
|||||||
{
|
{
|
||||||
throw new \Exception("Invalid value '$ret[filemode]' for attachmentType, must be one of: '".implode("', '", $valid)."'", 422);
|
throw new \Exception("Invalid value '$ret[filemode]' for attachmentType, must be one of: '".implode("', '", $valid)."'", 422);
|
||||||
}
|
}
|
||||||
|
// EPL share password and expiration
|
||||||
|
$ret['password'] = $password ?: null;
|
||||||
|
if (!empty($expiration))
|
||||||
|
{
|
||||||
|
$ret['expiration'] = (new Api\DateTime($expiration))->format('Y-m-d');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user