Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to set default permissions for comments

sledzinski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014

How and where can I Set default permissions for comments? I don't want (by default) that my customers can see comments which are added by my developers.

3 answers

1 accepted

2 votes
Answer accepted
BenjiI
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014

Hi Pawel,

All users (also customers) are added to the jira-users group by default. If you add a comment to an issue this comment will be visible for this jira-users group by default. If you want your comment to be visible only by one group, f.e jira-developers, you can change the scope of the comment here:

The comment will only be visible for the selected group. All users refers to the default jira-users group.

Hope this answers you question?!

BenjiI
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014

This small tutorial shows you how to set the default group that sees your comments:

https://developer.atlassian.com/display/JIRADEV/How+to+Set+Default+Comment+Security+Level

sledzinski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014

Hi Benji, I know it exactly :) But I need it to be automatic, because sometimes my developers forget about this option and then our customers could see comments. which they shouldn't see ;)

BenjiI
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2014

Hi Pawel,

Have a look at this template file:

WEB-INF/classes/templates/jira/global.vm

Around line 28 you find the templating that is used for setting the available options for comment visibility.

sledzinski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2014

There I have this code (from 1 to 47 line):

## comment-edit.vm

#macro (createLevelSelect $roleLevels $groupLevels $selected)
#set($currentSelection = "$i18n.getText('security.level.viewable.by.all')")
#set($locked = false)
#if ($isRolePresent)
#foreach ($level in $roleLevels)
#if($level.id && $selected == "role:${level.id.toString()}")
#set($currentSelection = "$i18n.getText('security.level.restricted.to', ${textutils.htmlEncode($level.name)})")
#set($locked = true)
#end
#end
#end
#if ($isGroupPresent)
#foreach ($level in $groupLevels)
#if($level && $selected == "group:${level}")
#set($currentSelection = "$i18n.getText('security.level.restricted.to', ${textutils.htmlEncode($level)})")
#set($locked = true)
#end
#end
#end
<div class="security-level">
<fieldset class="hidden parameters">
<input type="hidden" title="securityLevelViewableByAll" value="$i18n.getText('security.level.viewable.by.all')">
<input type="hidden" title="securityLevelViewableRestrictedTo" value="$i18n.getText('security.level.restricted.to')">
</fieldset>
<a class="drop" href="#"><span class="icon #if($locked)icon-locked #else icon-unlocked#end"></span><span class="icon drop-menu"></span></a>
<select name="commentLevel" id="commentLevel">
<option value="">$textutils.htmlEncode($i18n.getText('comment.constants.allusers'))</option>
#if ($isRolePresent)
<optgroup label="$i18n.getText('common.words.project.roles')">
#foreach ($level in $roleLevels)
<option value="role:${level.id}" #if($level.id && $selected == "role:${level.id.toString()}")selected="selected"#end>$textutils.htmlEncode($level.name)</option>
#end
</optgroup>
#end
#if ($isGroupPresent)
<optgroup label="$i18n.getText('common.words.groups')">
#foreach ($level in $groupLevels)
<option value="group:${textutils.htmlEncode($level)}" #if($level && $selected == "group:${level}")selected="selected"#end>$textutils.htmlEncode($level)</option>
#end
</optgroup>
#end
</select>
<span class="current-level">$currentSelection</span>
</div>
#end

What I have to change?

BenjiI
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2014

Hi Pawel,

Here is how to do it:

1) Open the file WEB-INF/classes/templates/jira/global.vm in your favorite text editor

2) Locate the following code:

#macro (createLevelSelect $roleLevels $groupLevels $selected)
    #set($currentSelection = "$i18n.getText('security.level.viewable.by.all')")
    #set($locked = false)
    #if ($isRolePresent)
        #foreach ($level in $roleLevels)
            #if($level.id &amp;&amp; $selected == "role:${level.id.toString()}")
                #set($currentSelection = "$i18n.getText('security.level.restricted.to', ${textutils.htmlEncode($level.name)})")
                #set($locked = true)
            #end
        #end
    #end

and replace it by:

#macro (createLevelSelect $roleLevels $groupLevels $selected)
    #set($selected = "role:10002")
    #set($currentSelection = "$i18n.getText('security.level.viewable.by.all')")
    #set($locked = false)
    #if ($isRolePresent)
        #foreach ($level in $roleLevels)
            #if($level.id &amp;&amp; $selected == "role:${level.id.toString()}")
                #set($currentSelection = "$i18n.getText('security.level.restricted.to', ${textutils.htmlEncode($level.name)})")
                #set($locked = true)
            #end
        #end
    #end

BenjiI
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2014

The line #set($selected = "role:10002") sets the default role. You have to find the role or group that suites your needs and use that id.

It is possible that you also have to restart your JIRA instance (not sure :))

Hope this helps?!

sledzinski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2014

I have to change the default role, but... IT'S WORKING! :) THANKS A LOT!

BenjiI
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2014

You are welcome, Pawel! :)

0 votes
Lance Wong September 2, 2014

All users refers to the default jira-users group.

i dont think this is true. Setting a comment scope of "all users" allows users in a group other than jira-users to see the comment. However, selecting the jira-users group does hide the comment from groups other than jira-users. I witnessed this in 6.2.7

0 votes
codelab expert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014
sledzinski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014

No, because my original file looks like this:

#disable_html_escaping()
$!{auiparams.put("controlHeaderClass", "aui-field-componentspicker $!fieldLayoutItem.rendererType")}
#customControlHeader ($action $field.id $i18n.getText($field.nameKey) $fieldLayoutItem.required $displayParameters $auiparams)
#if ($components && !$components.empty)
#if ($!isFrotherControl)<div class="ajs-multi-select-placeholder textarea long-field"></div>#end
#if (!$fieldLayoutItem.required)
#set ( $componentHeaderSize = 1)
#end
<select class="select #if ($!isFrotherControl)hidden#end" id="$field.id" multiple="multiple" name="$field.id"
size="#minSelectSize($components $componentHeaderSize 5)"
data-remove-null-options="true" data-submit-input-val="true" data-input-text="$textutils.htmlEncode($!frotherInputText)">
#if (!$fieldLayoutItem.required)
<option#if ($currentComponents && $unknownComponentId && $currentComponents.contains($unknownComponentId)) selected="selected"#end value="-1">
$i18n.getText('common.words.unknown')
</option>
#end
#foreach ($component in $components)
<option#if ($currentComponents && $component && $currentComponents.contains($component.getLong('id'))) selected="selected"#end title="$textutils.htmlEncode($component.getString("name")) #if($component.getString("description")) - $textutils.htmlEncode($component.getString("description"))#end" value="$!component.getLong('id')">
$textutils.htmlEncode($component.getString('name'))
</option>
#end
</select>
#if ($!isFrotherControl)<div class="description">${i18n.getText('generic.picker.static.desc')}</div>#end
#displayFieldWarning($displayParameters, $i18n.getText('bulk.edit.warning.component'))
#else
<span class="field-value">$i18n.getText('common.words.none')</span>
#end
#customControlFooter ($action $field.id $fieldLayoutItem.getFieldDescription() $displayParameters $auiparams)
$!{auiparams.clear()}

codelab expert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014

I suggest that you selected the wrong file. It seems that you selected the components-edit.vm but you must edit the comment-edit.vm! My JIRA version is 6.2.4 and the comment-edit.vm looks like described in the above link.

Please follow this instructions. It works!

sledzinski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014

I use 6.2.3 version. How can I should get the upgrade?

codelab expert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014

That's good and all is fine! Please lookup for the right file.

codelab expert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014

No, that's not normal. You should have this file otherwise it is not possible to add comments. Can you post a list of all files in this folder please?

sledzinski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014

I know where is the problem. I don't have this file there. Is it normal?

sledzinski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014

I found this file: /../atlassian/jira/atlassian-jira/WEB-INF/classes/templates/jira/issue/field - it isn't proper?

codelab expert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 19, 2014

Yes, the folder is right. Now, you need this file:

..\classes\templates\jira\issue\field\comment-edit.vm

sledzinski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2014

assignee-columnview.vm
assignee-edit-no-context.vm
assignee-edit.vm
assignee-view.vm
attachment-edit.vm
components-bulkmove.vm
components-columnview.vm
components-edit.vm
components-view.vm
creator-columnview.vm
creator-view.vm
date-columnview.vm
date-excelview.vm
description-columnview.vm
description-edit.vm
duedate-columnview.vm
duedate-edit.vm
duedate-view.vm
duration-columnview.vm
environment-columnview.vm
environment-edit.vm
issuelinks-columnview.vm
issuelinks-edit.vm
issuelinks-view.vm
issue-operations.vm
issuetype-columnview.vm
issuetype-edit-not-allowed.vm
issuetype-edit.vm
issuetype-view.vm
key-columnview.vm
labels-columnview.vm
labels-edit.vm
labels-view.vm
priority-columnview.vm
priority-edit.vm
priority-view.vm
progress-bar.vm
project-columnview.vm
project-edit.vm
reporter-columnview.vm
reporter-edit-frother.vm
reporter-edit.vm
reporter-view.vm
resolution-columnview.vm
resolutiondate-columnview.vm
resolution-edit.vm
resolution-view.vm
securitylevel-columnview.vm
securitylevel-edit.vm
securitylevel-subtask.vm
securitylevel-view.vm
status-columnview.vm
subtask-columnview.vm
summary-columnview.vm
summary-edit.vm
textfield-view.vm
thumbnail-columnview.vm
timetracking-bulkmove.vm
timetracking-edit.vm
timetracking-view.vm
userpickerfilter-config.soy
versions-bulkmove.vm
versions-columnview.vm
versions-edit.vm
versions-view.vm
votes-columnview.vm
watches-columnview.vm
worklog-edit.vm
workratio-columnview.vm

codelab expert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2014

Something is wrong with your JIRA instance. Please repair your instance. There are two files missing: comment-edit.vm and comment-view.vm

PulseI August 5, 2014

In Jira 6.x, comment-edit.vm has been renamed and moved.

You will now find it at:

/../atlassian-jira/WEB-INF/classes/templates/plugin/comment/system-comment-field-edit.vm

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events