Add canViewTag permission
authorMatthias Schmidt <gravatronics@live.com>
Thu, 10 Jul 2014 20:38:03 +0000 (22:38 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 10 Jul 2014 20:38:03 +0000 (22:38 +0200)
com.woltlab.wcf/templates/tagInput.tpl
com.woltlab.wcf/userGroupOption.xml
wcfsetup/install/files/lib/page/TaggedPage.class.php

index dd779043c3530e96a4013f1957a57c575065b389..aeb8daaf842b73fc3980876b8c458b5a0b6fdc23 100644 (file)
@@ -1,19 +1,22 @@
-<dl class="jsOnly">
-       <dt><label for="tagSearchInput{if $tagInputSuffix|isset}{@$tagInputSuffix}{/if}">{lang}wcf.tagging.tags{/lang}</label></dt>
-       <dd>
-               <div id="tagList{if $tagInputSuffix|isset}{@$tagInputSuffix}{/if}" class="editableItemList"></div>
-               <input id="tagSearchInput{if $tagInputSuffix|isset}{@$tagInputSuffix}{/if}" type="text" value="" class="long" />
-               <small>{lang}wcf.tagging.tags.description{/lang}</small>
-       </dd>
-</dl>
-<script data-relocate="true">
-       //<![CDATA[
-       $(function() {
-               var $tagList = new WCF.Tagging.TagList('#tagList{if $tagInputSuffix|isset}{@$tagInputSuffix}{/if}', '#tagSearchInput{if $tagInputSuffix|isset}{@$tagInputSuffix}{/if}', {@TAGGING_MAX_TAG_LENGTH});
-               
-               {if $tags|isset && $tags|count}
-                       $tagList.load([ {implode from=$tags item=tag}'{$tag|encodeJS}'{/implode} ]);
-               {/if}
-       });
-       //]]>
-</script>
\ No newline at end of file
+{if $__wcf->session->getPermission('user.tag.canViewTag')}
+       <dl class="jsOnly">
+               <dt><label for="tagSearchInput{if $tagInputSuffix|isset}{@$tagInputSuffix}{/if}">{lang}wcf.tagging.tags{/lang}</label></dt>
+               <dd>
+                       <div id="tagList{if $tagInputSuffix|isset}{@$tagInputSuffix}{/if}" class="editableItemList"></div>
+                       <input id="tagSearchInput{if $tagInputSuffix|isset}{@$tagInputSuffix}{/if}" type="text" value="" class="long" />
+                       <small>{lang}wcf.tagging.tags.description{/lang}</small>
+               </dd>
+       </dl>
+       
+       <script data-relocate="true">
+               //<![CDATA[
+               $(function() {
+                       var $tagList = new WCF.Tagging.TagList('#tagList{if $tagInputSuffix|isset}{@$tagInputSuffix}{/if}', '#tagSearchInput{if $tagInputSuffix|isset}{@$tagInputSuffix}{/if}', {@TAGGING_MAX_TAG_LENGTH});
+                       
+                       {if $tags|isset && $tags|count}
+                               $tagList.load([ {implode from=$tags item=tag}'{$tag|encodeJS}'{/implode} ]);
+                       {/if}
+               });
+               //]]>
+       </script>
+{/if}
index 65706b31e98d0556edd1c6c5db3d117a5963a2bf..1141a04be6b4185cda14d2a052f2d27469e834c3 100644 (file)
@@ -734,6 +734,14 @@ png]]></defaultvalue>
                                <admindefaultvalue>1</admindefaultvalue>
                                <usersonly>1</usersonly>
                        </option>
+                       
+                       <!-- todo: find better category -->
+                       <option name="user.tag.canViewTag">
+                               <categoryname>user.message</categoryname>
+                               <optiontype>boolean</optiontype>
+                               <defaultvalue>1</defaultvalue>
+                               <options>module_tagging</options>
+                       </option>
                </options>
        </import>
 </data>
index 45f766129fb9effc6d41cd9182abbb6bc29c10b6..7591f6565450051c03284ee5a1f317d8418804ca 100644 (file)
@@ -22,6 +22,11 @@ class TaggedPage extends MultipleLinkPage {
         */
        public $neededModules = array('MODULE_TAGGING');
        
+       /**
+        * @see \wcf\page\AbstractPage::$neededPermissions
+        */
+       public $neededPermissions = array('user.tag.canViewTag');
+       
        /**
         * tag id
         * @var integer