It's all about the answers!

Ask a question

Read-only work item attributes based on role and attribute

Dominik L. Blystak (1622) | asked Jun 22 '12, 5:07 a.m.
edited Apr 08 '13, 12:44 p.m. by Ralph Schoon (63.1k33646)
I'm using RTC, I have added an boolean attribute called "Contract relevant" to the epic work item and I would like to make epics with that attribute editable only to project managers.

I've read about script based validations and conditions in the wiki but I could not find a way to determine what role the current user has. How can I determine the users current role by using Java-Script or a Java customization?

In the first place conditions with the operation behavior settings seemed most appropriate for this task but as far as I understood they are only used to determine which additional attributes have to be set, when a condition matches. Is this assumption right and should I use validations to solve the problem or is there a better way?

2 answers

permanent link
Michele Pegoraro (1.8k14118103) | answered Jun 22 '12, 6:30 a.m.
if you want to use advisor (server side Java costumization) you can obtain the roles of an user using this methods:

IRole[] contributorRoles = processServerService.getServerProcess(processArea).getContributorRoles( contribHandle, processArea);

where processArea could be a TeamAreaHandle or a ProjectAreaHandle and you can obtain contribHandle using getAuthenticatedContributor() method (your advisor must extend AbstractService).

ProcessServerService could be obtained by getService() method.

But I think you could easily obtain the same result using process configuration permissions and giving the permission to save that attribute only to specific roles. Other users can edit it but cannot save it.


permanent link
Ralph Schoon (63.1k33646) | answered Apr 02 '13, 4:27 a.m.
As far as I can tell, it is not possible to access the role of a user in script based customization.
If you want to protect certain attributes and make them read only by role, you could try to follow and create a condition based on Java. And use the read-only for condition precondition (available in RTC 4.x). See for more information.

Otherwise you could implement an Advisor (precondition).  This post shows an advisor: and other posts on the blog show the operation ID you want to use as well as API to access the roles .

Follow and the links to the Extension Workshop to learn about how to setup your environment.

Your answer

Register or 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.