Add permission to delete foreign comments on own wall
authorMatthias Schmidt <gravatronics@live.com>
Wed, 9 Apr 2014 16:49:53 +0000 (18:49 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 9 Apr 2014 16:49:53 +0000 (18:49 +0200)
com.woltlab.wcf/userGroupOption.xml
wcfsetup/install/files/lib/data/comment/StructuredCommentList.class.php
wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index e8867ec71d4f97b04fc382df03df0a29d0e8f6f0..a14e67de1b49c36d4d7b5269f5b9b1e9873084d6 100644 (file)
@@ -577,19 +577,22 @@ png]]></defaultvalue>
                                <optiontype>boolean</optiontype>
                                <defaultvalue>1</defaultvalue>
                        </option>
-                       
                        <option name="user.profileComment.canEditComment">
                                <categoryname>user.profileComment</categoryname>
                                <optiontype>boolean</optiontype>
                                <defaultvalue>1</defaultvalue>
                        </option>
-                       
                        <option name="user.profileComment.canDeleteComment">
                                <categoryname>user.profileComment</categoryname>
                                <optiontype>boolean</optiontype>
                                <defaultvalue>0</defaultvalue>
                                <admindefaultvalue>1</admindefaultvalue>
                        </option>
+                       <option name="user.profileComment.canDeleteCommentInOwnProfile">
+                               <categoryname>user.profileComment</categoryname>
+                               <optiontype>boolean</optiontype>
+                               <defaultvalue>0</defaultvalue>
+                       </option>
                        <!-- /user.profileComment -->
                        
                        <option name="admin.content.label.canManageLabel">
index 3857ea6bf1787b43628e7ffc119b60225611bdfe..23e01bd4da9eea39a44a77a7ba319b463b37e44a 100644 (file)
@@ -91,7 +91,7 @@ class StructuredCommentList extends CommentList {
                                $this->responseIDs[] = $responseID;
                                $responseIDs[$responseID] = $comment->commentID;
                        }
-
+                       
                        if ($comment->userID) {
                                $userIDs[] = $comment->userID;
                        }
index e391930a6837eae25fa462703ecd79112d5b2e98..aeae3d325d68fee626cced9c22272f907f468fdb 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 namespace wcf\system\comment\manager;
+use wcf\data\comment\response\CommentResponse;
+use wcf\data\comment\Comment;
 use wcf\data\user\UserProfile;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
@@ -93,5 +95,29 @@ class UserProfileCommentManager extends AbstractCommentManager {
        /**
         * @see \wcf\system\comment\manager\ICommentManager::updateCounter()
         */
-       public function updateCounter($objectID, $value) { }
+       public function updateCounter($objectID, $value) {
+               // does nothing
+       }
+       
+       /**
+        * @see \wcf\system\comment\manager\ICommentManager::canDeleteComment()
+        */
+       public function canDeleteComment(Comment $comment) {
+               if ($comment->objectID == WCF::getUser()->userID && WCF::getSession()->getPermission('user.profileComment.canDeleteCommentInOwnProfile')) {
+                       return true;
+               }
+               
+               return parent::canDeleteComment($comment);
+       }
+       
+       /**
+        * @see \wcf\system\comment\manager\ICommentManager::canDeleteResponse()
+        */
+       public function canDeleteResponse(CommentResponse $response) {
+               if ($response->getComment()->objectID == WCF::getUser()->userID && WCF::getSession()->getPermission('user.profileComment.canDeleteCommentInOwnProfile')) {
+                       return true;
+               }
+               
+               return parent::canDeleteResponse($response);
+       }
 }
index bc39f8475cce84e2ae1bf1abc32b3b7818322e67..f751d89f69bacda809aa67c9a420edf629714923 100644 (file)
                <item name="wcf.acp.group.option.user.profileComment.canAddComment"><![CDATA[Kann Pinnwand-Kommentare erstellen]]></item>
                <item name="wcf.acp.group.option.user.profileComment.canEditComment"><![CDATA[Kann eigene Pinnwand-Kommentare bearbeiten]]></item>
                <item name="wcf.acp.group.option.user.profileComment.canDeleteComment"><![CDATA[Kann eigene Pinnwand-Kommentare löschen]]></item>
+               <item name="wcf.acp.group.option.user.profileComment.canDeleteCommentInOwnProfile"><![CDATA[Kann Kommentare an der eigenen Pinnwand löschen]]></item>
                <item name="wcf.acp.group.option.mod.profileComment.canEditComment"><![CDATA[Kann Pinnwand-Kommentare bearbeiten]]></item>
                <item name="wcf.acp.group.option.mod.profileComment.canDeleteComment"><![CDATA[Kann Pinnwand-Kommentare löschen]]></item>
                <item name="wcf.acp.group.option.mod.profileComment.canModerateComment"><![CDATA[Kann Pinnwand-Kommentare moderieren]]></item>
index f52f3cc2b2d18d322bcc6c6937a61da915521868..2b46c08c13a13d2aec7bd0c7e65007301bf3e37e 100644 (file)
@@ -356,6 +356,7 @@ Examples for medium ID detection:
                <item name="wcf.acp.group.option.user.profileComment.canAddComment"><![CDATA[Can create comments]]></item>
                <item name="wcf.acp.group.option.user.profileComment.canEditComment"><![CDATA[Can edit own comments]]></item>
                <item name="wcf.acp.group.option.user.profileComment.canDeleteComment"><![CDATA[Can delete own comments]]></item>
+               <item name="wcf.acp.group.option.user.profileComment.canDeleteCommentInOwnProfile"><![CDATA[Can delete comments on their own wall]]></item>
                <item name="wcf.acp.group.option.mod.profileComment.canEditComment"><![CDATA[Can edit comments]]></item>
                <item name="wcf.acp.group.option.mod.profileComment.canDeleteComment"><![CDATA[Can delete comments]]></item>
                <item name="wcf.acp.group.option.mod.profileComment.canModerateComment"><![CDATA[Can moderate comments]]></item>