How to get user loged in RTC for customization
Accepted answer
...
dojo.require("com.ibm.team.repository.web.client.session.Session");
...
Very easy
(function() {
...
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var getAuthenticatedContributor = com.ibm.team.repository.web.client.session.getAuthenticatedContributor;
dojo.declare("com.ibm.san.ariadna.process.SampleReadOnlyCondition", null,
{
matches : function(workItem, configuration) {
var loggedInUser = getAuthenticatedContributor().itemId;
var owner = workItem.getValue(WorkItemAttributes.OWNER);
var result = (loggedInUser != owner);
return result;
}
});
})();
3 other answers
Sam,
I'm using 'Script based condition' and I need to restrict the change of an attribute only if the logged user is the same owner workItem. and I have the 'owner' of Workitem(workItem.getLabel("owner");), but not how to get the user logged to compare and condition. or is there another way to do this?
thx.
I'm using 'Script based condition' and I need to restrict the change of an attribute only if the logged user is the same owner workItem. and I have the 'owner' of Workitem(workItem.getLabel("owner");), but not how to get the user logged to compare and condition. or is there another way to do this?
thx.
thanks,
Don't exist any way to condition this ???
Don't exist any way to condition this ???
Comments
It may be possible using a a JAVA based handler..
https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/
also look at this, https://jazz.net/forum/questions/133477/work-item-customization-getting-current-user-as-logged-in-user
has a sample java based script.
Comments
sam detweiler
Dec 22 '14, 9:47 a.m.please explain a little more.. script? mean javascript? value, default, ???
I don't think you can get the current contributor (or set those type fields) with script extensions to field handling in javascript.