diff --git a/dev/Model/FolderCollection.js b/dev/Model/FolderCollection.js index b75c728fa..65fe71446 100644 --- a/dev/Model/FolderCollection.js +++ b/dev/Model/FolderCollection.js @@ -366,20 +366,19 @@ export class FolderModel extends AbstractModel { }) .extend({ notify: 'always' }); */ -/* - https://www.rfc-editor.org/rfc/rfc8621.html#section-2 - "myRights": { - "mayAddItems": true, - "mayRename": false, - "maySubmit": true, - "mayDelete": false, - "maySetKeywords": true, - "mayRemoveItems": true, - "mayCreateChild": true, - "maySetSeen": true, - "mayReadItems": true - }, -*/ + + // https://www.rfc-editor.org/rfc/rfc8621.html#section-2 + this.myRights = { + 'mayAddItems': true, + 'mayCreateChild': true, + 'mayDelete': true, + 'mayReadItems': true, + 'mayRemoveItems': true, + 'mayRename': true, + 'maySetKeywords': true, + 'maySetSeen': true, + 'maySubmit': true + }; this.addComputables({ diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Folder.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Folder.php index 258dfaf40..6114ca1b2 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Folder.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Folder.php @@ -148,6 +148,7 @@ class Folder implements \JsonSerializable #[\ReturnTypeWillChange] public function jsonSerialize() { + $selectable = $this->Selectable(); $result = array( '@Object' => 'Object/Folder', 'name' => $this->Name(), @@ -163,16 +164,17 @@ class Folder implements \JsonSerializable 'size' => $this->SIZE, 'role' => $this->Role(), - 'myRights' => [ - 'mayReadItems' => !$this->myRights || ($this->myRights->hasRight('l') && $this->myRights->hasRight('r')), - 'mayAddItems' => !$this->myRights || $this->myRights->hasRight('i'), - 'mayRemoveItems' => !$this->myRights || ($this->myRights->hasRight('t') && $this->myRights->hasRight('e')), - 'maySetSeen' => !$this->myRights || $this->myRights->hasRight('s'), - 'maySetKeywords' => !$this->myRights || $this->myRights->hasRight('w'), - 'mayCreateChild' => !$this->myRights || $this->myRights->hasRight('k'), - 'mayRename' => !$this->myRights || $this->myRights->hasRight('x'), - 'mayDelete' => !$this->myRights || $this->myRights->hasRight('x'), - 'maySubmit' => !$this->myRights || $this->myRights->hasRight('p') + 'rights' => $this->myRights, + 'myRights' => $this->myRights ? $this->myRights->JMAP() : [ + 'mayReadItems' => $selectable, + 'mayAddItems' => $selectable, + 'mayRemoveItems' => $selectable, + 'maySetSeen' => $selectable, + 'maySetKeywords' => $selectable, + 'mayCreateChild' => $selectable, + 'mayRename' => $selectable, + 'mayDelete' => $selectable, + 'maySubmit' => $selectable ] ); if ($this->etag) { diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Responses/ACL.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Responses/ACL.php index 3da0a0be9..8c356cb60 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Responses/ACL.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Responses/ACL.php @@ -46,4 +46,19 @@ class ACL implements \JsonSerializable return $this->rights; } + public function JMAP() : array + { + return [ + 'mayReadItems' => ($this->hasRight('l') && $this->hasRight('r')), + 'mayAddItems' => $this->hasRight('i'), + 'mayRemoveItems' => ($this->hasRight('t') && $this->hasRight('e')), + 'maySetSeen' => $this->hasRight('s'), + 'maySetKeywords' => $this->hasRight('w'), + 'mayCreateChild' => $this->hasRight('k'), + 'mayRename' => $this->hasRight('x'), + 'mayDelete' => $this->hasRight('x'), + 'maySubmit' => $this->hasRight('p') + ]; + } + }