Added "can edit message" permission
authorMarcel Werk <burntime@woltlab.com>
Mon, 19 May 2014 23:24:14 +0000 (01:24 +0200)
committerMarcel Werk <burntime@woltlab.com>
Mon, 19 May 2014 23:24:14 +0000 (01:24 +0200)
files/lib/data/conversation/message/ConversationMessage.class.php
files/lib/form/ConversationMessageEditForm.class.php
language/de.xml
language/en.xml
userGroupOption.xml

index cafc3f6dc0beb94b272122f968a607918612cdd3..dc09d584fb0460e223a7215f6ff8503715d9befc 100644 (file)
@@ -135,7 +135,7 @@ class ConversationMessage extends DatabaseObject implements IMessage {
         * @return      boolean
         */
        public function canEdit() {
-               return (WCF::getUser()->userID == $this->userID);
+               return (WCF::getUser()->userID == $this->userID && ($this->getConversation()->isDraft || WCF::getSession()->getPermission('user.conversation.canEditMessage')));
        }
        
        /**
index 2858f48c03673d82ae4128cf9b2f5b7af5e7350f..42aad7294000556be169828d8017a00c4fcf9aef 100644 (file)
@@ -76,12 +76,12 @@ class ConversationMessageEditForm extends ConversationAddForm {
                if (!$this->message->messageID) {
                        throw new IllegalLinkException();
                }
-               if ($this->message->userID != WCF::getUser()->userID) {
+               if (!$this->message->canEdit()) {
                        throw new PermissionDeniedException();
                }
                // get conversation
                $this->conversationID = $this->message->conversationID;
-               $this->conversation = new Conversation($this->conversationID);
+               $this->conversation = $this->message->getConversation();
                
                if ($this->conversation->firstMessageID == $this->message->messageID) {
                        $this->isFirstMessage = true;
index 13c7bba7e6fe3ff111a21f5ac932908fc7bcf922..b63976fef0f9fa6470704663b8ac85491f071b9d 100644 (file)
@@ -19,6 +19,8 @@
                <item name="wcf.acp.group.option.user.conversation.allowedAttachmentExtensions"><![CDATA[Erlaubte Dateiendungen]]></item>
                <item name="wcf.acp.group.option.user.conversation.allowedAttachmentExtensions.description"><![CDATA[Eine Dateiendung pro Zeile]]></item>
                <item name="wcf.acp.group.option.user.conversation.maxAttachmentCount"><![CDATA[Maximale Dateianhänge pro Nachricht]]></item>
+               <item name="wcf.acp.group.option.user.conversation.canEditMessage"><![CDATA[Kann eigene Nachrichten bearbeiten]]></item>
+               <item name="wcf.acp.group.option.user.conversation.canEditMessage.description"><![CDATA[Mitglieder dieser Benutzergruppe können eigene Nachrichten in Konversationen nachträglich verändern, auch wenn diese bereits vom Empfänger gelesen wurden.]]></item>
        </category>
        
        <category name="wcf.acp.option">
index 1032cd67f2da6150ddce3adebb45bb2db7d9ffc6..d84087a6eb49107d06ea3aae0856edf5b3d29e89 100644 (file)
@@ -19,6 +19,8 @@
                <item name="wcf.acp.group.option.user.conversation.allowedAttachmentExtensions"><![CDATA[Allowed File Extensions]]></item>
                <item name="wcf.acp.group.option.user.conversation.allowedAttachmentExtensions.description"><![CDATA[One extension per line]]></item>
                <item name="wcf.acp.group.option.user.conversation.maxAttachmentCount"><![CDATA[Maximum Attachments per Message]]></item>
+               <item name="wcf.acp.group.option.user.conversation.canEditMessage"><![CDATA[TODO: Kann eigene Nachrichten bearbeiten]]></item>
+               <item name="wcf.acp.group.option.user.conversation.canEditMessage.description"><![CDATA[TODO: Mitglieder dieser Benutzergruppe können eigene Nachrichten in Konversationen nachträglich verändern, auch wenn diese bereits vom Empfänger gelesen wurden.]]></item>
        </category>
        
        <category name="wcf.acp.option">
index 6094653586dc834f02d5ff6235ca2a38f0591415..ebd01092a51abb8dbb9eee5784214b549fdef692 100644 (file)
                                <defaultvalue>1</defaultvalue>
                                <enableoptions>user.conversation.canSetCanInvite,user.conversation.canAddInvisibleParticipants,user.conversation.maxParticipants,user.conversation.maxConversations,user.conversation.maxLabels,user.conversation.maxLength,user.conversation.canUploadAttachment</enableoptions>
                        </option>
+                       <option name="user.conversation.canEditMessage">
+                               <categoryname>user.conversation</categoryname>
+                               <optiontype>boolean</optiontype>
+                               <defaultvalue>1</defaultvalue>
+                       </option>
                        <option name="user.conversation.canSetCanInvite">
                                <categoryname>user.conversation</categoryname>
                                <optiontype>boolean</optiontype>