how to get currect user process roles of project area in javascript
kavita herur (58●7●68●94)
| asked Jan 02 '13, 7:03 a.m.
edited Mar 21 '13, 11:30 a.m. by Ralph Schoon (63.5k●3●36●46) Hi All, I have added read only for condition in my project area with javascript. In java script I want to check current user's preocess role. If user has admin role in project area then he can edit the work item. Form net I got the below code IRole[] contributorRoles = processServerService.getServerProcess(processArea).getContributorRoles( contribHandle, processArea); But how to get values for contribHandle,processServerService. I found another jazz link but it gives creator not current user and roles. please can any one tell me how to get current user roles in javascript.
Thanks, Kavita
showing 5 of 6
show 1 more comments
|
2 answers
Ralph Schoon (63.5k●3●36●46)
| answered Jan 02 '13, 10:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Kavita, as far as I can tell you can't do that with scripts. We had a similar question some days ago. Please go there for the details. https://jazz.net/library/article/1093 will soon talk about JavaScript too and provide an overview of the limitations.
JavaScript is for simple customization and has limits. You can only access the work item itself and only limited for attributes for complex types. So if you want to do quite complex things that exceed the data of the work item available, you should look into a Java Server extension, rather than using JavaScript. Comments
kavita herur
commented Jan 09 '13, 9:24 a.m.
Thanks Ralph,
I got how to get user roles in extensions, but my concern is Read only for condition can be done through extensions? Currently in RTC 4.0 its feature added through java script to project area.
Hi Kavita,
kavita herur
commented Jan 11 '13, 5:52 a.m.
Ralph, Please can you brief on what on what next to be done? Is it possible with condition Advisors at server side? Is there any link ? You should rethink your approach. Try using Permissions instead. You can limit the permission to manipulate work items in the Team Configuration: https://jazz.net/library/article/291 . The work item would fail saving for the roles except the admin role.
|
Ralph Schoon (63.5k●3●36●46)
| answered Mar 21 '13, 11:34 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
After reading more, i stumbled across this content https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Providing_new_customizations_imp . I think this would be the way to go, if you want to contribute to conditions, but need the Java API. Please be aware you might need to deploy it on the server and the Eclipse client, if i understand it correctly.
|
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.
Comments
There are a variety of permissions and operational behaviors that can be controlled based on role. Have you determined that you can't do what you want via those customizations rather than customizing via scripting/programming? If you can provide some more details, I might be able to suggest a different approach.
This was Kavita's reply (it came via email as there may have been an issue with the forum earlier today):
Can you explain how you would like the application to behave rather than what customizations you have attempted? Are you trying to make everything read-only? Is a particular field read-only? We constantly work on improving the product and if you use scripting when other methods are available, you can make upgrading to newer versions more difficult on yourself and your team. It is likely permissions or operational behaviors can be used to solve your issue, but I can't help unless I understand it. As Ralph points out, there is not likely a scripting solution to this.
The field Attr_A is present in all work items types. I want to make read only those WTs in which Attr_A 's value is "GHOST". Only admin role can edit those WTs.
This Java script will be included in pre-conditions. In our PA preconditionds are applied to default role.So it applys to admin role too.
please can u suggest solution ?
is there way to do with extensions at server side or any other alternate solution?
So you have a custom field you have added to all work item types whose only purpose is to make instances of that type read-only when someone changes the value to "GHOST" and you want Administrators to be able to edit them no matter what the value of that field is. Do these items ever get out of that state and become editable by non-admins again?
Kavita, if you consider a Java Extension, please look here for a similar discussion and some hints where to get information: https://jazz.net/forum/questions/97599/how-to-use-javascript-api-to-get-all-the-users-idaccounts-in-an-role-by-the-role-name/97645