diff --git a/dev/Model/FolderCollection.js b/dev/Model/FolderCollection.js
index d7d51b413..eef7f5e77 100644
--- a/dev/Model/FolderCollection.js
+++ b/dev/Model/FolderCollection.js
@@ -27,6 +27,9 @@ import Remote from 'Remote/User/Fetch';
import { FileInfo } from 'Common/File';
+import { FolderPopupView } from 'View/Popup/Folder';
+import { showScreenPopup } from 'Knoin/Knoin';
+
const
// isPosNumeric = value => null != value && /^[0-9]*$/.test(value.toString()),
@@ -481,7 +484,8 @@ export class FolderModel extends AbstractModel {
}
edit() {
- this.canBeEdited() && this.editing(true);
+// this.canBeEdited() && this.editing(true);
+ this.canBeEdited() && showScreenPopup(FolderPopupView, [this]);
}
unedit() {
diff --git a/dev/Settings/User/Folders.js b/dev/Settings/User/Folders.js
index 418113cb6..de2d7019e 100644
--- a/dev/Settings/User/Folders.js
+++ b/dev/Settings/User/Folders.js
@@ -15,6 +15,7 @@ import Remote from 'Remote/User/Fetch';
import { showScreenPopup } from 'Knoin/Knoin';
+//import { FolderPopupView } from 'View/Popup/Folder';
import { FolderCreatePopupView } from 'View/Popup/FolderCreate';
import { FolderSystemPopupView } from 'View/Popup/FolderSystem';
diff --git a/dev/View/Popup/Folder.js b/dev/View/Popup/Folder.js
new file mode 100644
index 000000000..d9502d58a
--- /dev/null
+++ b/dev/View/Popup/Folder.js
@@ -0,0 +1,44 @@
+import { addObservablesTo } from 'External/ko';
+
+import { AbstractViewPopup } from 'Knoin/AbstractViews';
+
+import Remote from 'Remote/User/Fetch';
+
+export class FolderPopupView extends AbstractViewPopup {
+ constructor() {
+ super('Folder');
+ addObservablesTo(this, {
+ folder: null // FolderModel
+ });
+
+ this.ACL = ko.observableArray();
+ }
+
+ onClose() {
+ this.folder().unedit();
+ }
+
+ submitForm(form) {
+ this.folder().rename();
+ console.dir({form});
+ this.close();
+ }
+
+ beforeShow(folder) {
+ this.ACL([]);
+ folder.editing(true);
+ this.folder(folder);
+ Remote.request('FolderACL', (iError, data) => {
+ if (!iError && data.Result) {
+ this.ACL(
+ Object.entries(data.Result).map(([key, value]) => {
+ value.identifier = key;
+ return value;
+ })
+ );
+ }
+ }, {
+ folder: folder.fullName
+ });
+ }
+}
diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/ACL.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/ACL.php
index 264bf9329..93d011e3e 100644
--- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/ACL.php
+++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/ACL.php
@@ -61,13 +61,18 @@ trait ACL
return $rights->hasRight('i');
case 'EXPUNGE':
return $rights->hasRight('e');
-
-// case 'SUBSCRIBE':
-// case 'UNSUBSCRIBE':
-// case 'CLOSE':
-// case 'FETCH':
-// case 'STORE':
-
+/*
+ case 'SUBSCRIBE':
+ return $rights->hasRight('l') || true;
+ case 'UNSUBSCRIBE':
+ return true;
+ case 'CLOSE':
+ return $rights->hasRight('e') || true;
+ case 'FETCH':
+ return $rights->hasRight('s') || true;
+ case 'STORE':
+ return $rights->hasRight('s') || $rights->hasRight('w') || $rights->hasRight('t');
+*/
case 'GETACL':
case 'SETACL':
case 'LISTRIGHTS':
@@ -104,13 +109,17 @@ trait ACL
$oResponses = $this->SendRequestGetResponse('GETACL', array($this->EscapeFolderName($sFolderName)));
$aResult = array();
foreach ($oResponses as $oResponse) {
+ // * ACL INBOX.shared demo@snappymail.eu akxeilprwtscd foobar@snappymail.eu akxeilprwtscd demo2@snappymail.eu lrwstipekxacd
if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oResponse->ResponseType
&& isset($oResponse->ResponseList[4])
&& 'ACL' === $oResponse->ResponseList[1]
&& $sFolderName === $oResponse->ResponseList[2]
)
{
- $aResult[$oResponse->ResponseList[3]] = static::aclRightsToClass(\array_slice($oResponse->ResponseList, 4));
+ $c = \count($oResponse->ResponseList);
+ for ($i = 3; $i < $c; $i += 2) {
+ $aResult[$oResponse->ResponseList[$i]] = new ACLResponse(\str_split($oResponse->ResponseList[$i+1]));
+ }
}
}
return $aResult;
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 6114ca1b2..0a8ded6f7 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
@@ -165,7 +165,7 @@ class Folder implements \JsonSerializable
'role' => $this->Role(),
'rights' => $this->myRights,
- 'myRights' => $this->myRights ? $this->myRights->JMAP() : [
+ 'myRights' => $this->myRights ?: [
'mayReadItems' => $selectable,
'mayAddItems' => $selectable,
'mayRemoveItems' => $selectable,
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 8c356cb60..e0a0cbbbd 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
@@ -42,11 +42,6 @@ class ACL implements \JsonSerializable
#[\ReturnTypeWillChange]
public function jsonSerialize()
- {
- return $this->rights;
- }
-
- public function JMAP() : array
{
return [
'mayReadItems' => ($this->hasRight('l') && $this->hasRight('r')),
@@ -57,7 +52,8 @@ class ACL implements \JsonSerializable
'mayCreateChild' => $this->hasRight('k'),
'mayRename' => $this->hasRight('x'),
'mayDelete' => $this->hasRight('x'),
- 'maySubmit' => $this->hasRight('p')
+ 'maySubmit' => $this->hasRight('p'),
+ 'raw' => \implode('', $this->rights)
];
}
diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Folders.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Folders.php
index da5d941d1..e92db6b26 100644
--- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Folders.php
+++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Folders.php
@@ -321,4 +321,39 @@ trait Folders
return $this->DefaultResponse($this->SettingsProvider(true)->Save($oAccount, $oSettingsLocal));
}
+
+ public function DoFolderACL() : array
+ {
+ $this->initMailClientConnection();
+ return $this->DefaultResponse(
+ $this->ImapClient()->FolderGetACL(
+ $this->GetActionParam('folder', '')
+ )
+ );
+ }
+
+ public function DoFolderDeleteACL() : array
+ {
+ $this->initMailClientConnection();
+ $this->ImapClient()->FolderDeleteACL(
+ $this->GetActionParam('folder', ''),
+ $this->GetActionParam('identifier', '')
+ );
+ return $this->TrueResponse();
+ }
+
+ public function DoFolderSetACL() : array
+ {
+// $oImapClient->FolderSetACL('INBOX', 'demo@snappymail.eu', 'lrwstipekxacd');
+// $oImapClient->FolderSetACL($sFolderFullName, 'demo@snappymail.eu', 'lrwstipekxacd');
+// $oImapClient->FolderSetACL($sFolderFullName, 'foobar@snappymail.eu', 'lr');
+ $this->initMailClientConnection();
+ $this->ImapClient()->FolderSetACL(
+ $this->GetActionParam('folder', ''),
+ $this->GetActionParam('identifier', ''),
+ $this->GetActionParam('rights', '')
+ );
+ return $this->TrueResponse();
+ }
+
}
diff --git a/snappymail/v/0.0.0/app/templates/Views/User/PopupsFolder.html b/snappymail/v/0.0.0/app/templates/Views/User/PopupsFolder.html
new file mode 100644
index 000000000..9618132ac
--- /dev/null
+++ b/snappymail/v/0.0.0/app/templates/Views/User/PopupsFolder.html
@@ -0,0 +1,54 @@
+