How to get the current userID in a condiftion javascript
VERT Eric (15●3●3)
| asked Mar 15 '13, 5:49 p.m.
edited Mar 16 '13, 9:18 a.m. by Ralph Schoon (63.7k●3●36●48)
I need to put a field on readonly mode for some users is there someone to help me ?
|
4 answers
No idea about Java, but why not using preconditions which are build in
|
Ralph Schoon (63.7k●3●36●48)
| answered Mar 18 '13, 4:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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.
|
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. |
Ralph Schoon (63.7k●3●36●48)
| answered May 21 '15, 4:02 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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.
|
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.