what i want to implement is that,if current login user doesn't belong to the project role "PDM",then he can not choose "Duplicate" as resolution.
so at first,i shall judge current login user belonging to a specified project role or not.
i searched jira api,and found "isUserInProjecRole" mehod."boolean isUserInProjectRole(User user, ProjectRole projectRole, Project project) "
the first parameter is User object.i guess "User(String name, ProviderAccessor providerAccessor, com.atlassian.crowd.embedded.api.CrowdService crowdService) " can create the User object.but i don't know how to use the constructor.the parameter "providerAccessor" i can not understand.
anyone knows how to implement it? or can share full code about implement approach
my jira version is 4.4.1
Community moderators have prevented the ability to post new answers.
Hi ,
I have develped custom field , the field should be visible to particular user at the time of creating issue .
How it could be possible ?
Can you help me ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i find "ProjectRole getProjectRole(String name)" in jira 5.0.1 api,its interface is ProjectRoleManager.i think this method can get project role object.but i don't know how to get ProjectRoleManager object.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is a spelling mistake, fabby :)
String curruesr=user.getFullName()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Mizan,
i modify the script to,
import com.opensymphony.user.User import com.atlassian.jira.security.JiraAuthenticationContext import com.atlassian.jira.ComponentManager FormField formField = getFieldById("resolution") FormField comField = getFieldById("comment") ComponentManager componentManager=ComponentManager.getInstance() User user = componentManager.getJiraAuthenticationContext().getUser() String curruesr=user.getFullName() comField.setFormValue("current user is :"+curruser)
field "comment" returns nothing,and found error in log file
2012-06-05 15:42:22,997 http-8079-7 ERROR jirauser 942x2244x1 17twilp 127.0.0.1 /rest/com.onresolve.jira.plugin.Behaviours/1.0/behaviours/runvalidator.json [onresolve.jira.groovy.BehaviourManagerImpl] Found class but could not find method run
groovy.lang.MissingPropertyException: No such property: curruser for class: Script1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this
User currentUser = componentManager.getJiraAuthenticationContext().getUser()
Even add some logging in your script .
And i am not sure but this user object cant be an argument in this method
isUserInProjectRole(User user, ProjectRole projectRole, Project project)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import com.opensymphony.user.User import com.atlassian.jira.security.JiraAuthenticationContext import com.atlassian.jira.component.ComponentAccessor.* FormField formField = getFieldById("resolution") FormField comField = getFieldById("comment") com.atlassian.crowd.embedded.api.User user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def curruesr=user.getFullName() comField.setFormValue("current user is :"+curruser)
i try to use the script above ,but the filed "comment" returnes nothing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.