I have developed JIRA custom field plugin(type : text) and i want it to be visible only for particular user .
How to check currently logged in user of JIRA in velocity template ?
Do i need to fetch loggedin user in my java file and then assign to varaible then it can be accessible to vm file
you can try with $authcontext.loggedInUser.name
try with this idf you want check current user in specific group
check this, it may help you
Thanks lot :)
I ll explain my scenario :
I have developed one custom field plugin , wanted to display only for the user who belong to particular group.
I have used the below line of code in my edit.vm file and built a jar deployed in jira using admin role , then created new custom field using that JAR addedd to particular project and to the screen which the project is using.
After logeg in to jira as normal user still i'm not able to view that field when creating issue.
Could you pls help me
<input type="text" name="$customField.id" value="$value" id="$customField.id" class="text"/>
<input type="text" name="$customField.id" value="" id="$customField.id" class="text"/>
Still it is hidden only . Even if user in 'jira-user' group not able to view when creating issue .
hi @rambanam prasad
Thanks for your immmediate respone for my queries .
In the above link i coudn't find
"jiraUserUtils" object .The only thing i could see the object for velocity template
in this link, but i want to know how the objects can be used in velocity template
In the above example "
$authcontext" object is used to find logged in user and i have checked the corresponding API class in the below link:
Here i couldn't find "loggedInUser" method instead "getLoggedInUser" is available anyhow i considered that "getLoggedInUser" can also be called as "
$authcontext.loggedInUser" ,but "name" is not available in that class.
from where it's being called.
Could you please explain ?
i am not much expertise in velocity files, i suggest gothrough the following document
you can find the
"jiraUserUtils" Object here i think you can use UserUtils Object also to get user details
$authcontext.loggedInUser" will return the User Object in that getName() method is there so use the "$authcontext.loggedInUser.name"
How to hide label:
where you have declared label for your field?
Actually i have build custom field jira plugin where it is visible only for "jira-users"
group .then i have uploaded to "Universal plugin manager" in JIRA
When creating new custom field ,Name for the field must be set and assigned that filed to screen which is used in "X" project.
when creating issue , field input box displaying to the user who belong to the "Jira-users" group, but when the other user creating the issue at that time filed is hidden but the name for the field is still displaying which has been set when the custom field is created.
I want to display the field only to the members who is belong to 'jira-users' group .
I have tried this above refrence URL ,but it is not displaying field even the user belong to 'jira-users' group
In the above example i have used 'Jira-users' instaed of 'Jira-administrators'.
i am not sure how to hide the custom field name in velocity file
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG