Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to get the current userID in a condiftion javascript

I need to put a field on readonly mode for some users is there someone to help me ?

0 votes



4 answers

Permanent link
Please see answer https://jazz.net/forum/questions/133477/work-item-customization-getting-current-user-as-logged-in-user/184711 for how to get the item ID for the user that runs the operation. Thanks to Amaury Quintero for providing this info.

0 votes


Permanent link
Maybe can be helpful for someone trying to get the current user using JS API (dojo). I've solved this need like that:

var currentUser =      com.ibm.team.repository.web.client.session.getAuthenticatedContributor;


That var has a property called itemId which retrieves the user internal ID
like _JPlIwJMVEeOQyJhn3MD2hQ, such property can be compared with the value retrieved from an attribute 
like com.ibm.team.workitem.attribute.owner.
With this concept in mind, you can use the Attribute customizations and create a Condition Script used in cooperation with the built-in Advisor Read-Only Attributes For Condition.

0 votes


Permanent link
As far as I can tell, there is no way to access the user ID of the user that is currently logged in and working with the work item in JavaScript. See https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript for what is possible. From the same page, I would assume it would be possible to use the JavaAPI to create a condition. Although I have note yet tried that myself, I would assume that in the condition plugin you would be able to access the logged in user.

0 votes


Permanent link
No idea about Java, but why not using preconditions which are build in


0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 6,117

Question asked: Mar 15 '13, 5:49 p.m.

Question was seen: 8,070 times

Last updated: May 21 '15, 4:02 p.m.

Confirmation Cancel Confirm