It's all about the answers!

Ask a question

How to get all project areas not only the user's project areas but also other projects for a special user without password using RTC plain Java api?


Qin Zhang (1122) | asked Jun 24 '13, 7:40 a.m.
edited Jun 27 '13, 6:53 a.m. by Ralph Schoon (60.9k33643)
 Using RTC Java api, I connect to the ITeamRepository repository with administrator, then use repository.contributorManager().fetchContributorByUserId(username) to verify the given user is available for the team repository. 

Now I want to get all project areas for the special username, but I don't know its password. Use processItemService.findProcessAreas(userContributor, null, IProcessItemService.ALL_PROPERTIES, null); only can find out project areas whose members contain the given usename, but I need to find  out all project areas the user can access just like he logged in to RTC Web Server.

Can anyone give some advice? The requirement is urgent. 

Thanks advance!

3 answers



permanent link
sam detweiler (12.5k6188201) | answered Jun 24 '13, 8:05 a.m.
for the other projects, you will have to find all the projects that are Public access (where the user does not need to be registered), and all the projects where the users Role grants him access.

I do not know thew APIs to do these two tasks.

Comments
Qin Zhang commented Jun 26 '13, 11:21 p.m.

Thank you very much, the API about to find all the projects that are Public access can use APIs as follows:

  1. Find out all project areas with IProcessItemService processItemService = (IProcessItemService)repository.getClientLibrary(IProcessItemService.class); List list = processItemService.findAllProjectAreas(processItemService.ALL_PROPERTIES, null);

  2. For every element in the list is project area object, use projectArea.isInternalPublic() can tell that weather it is public access

One more question, how to get all members about the Team Area Hierarchy for the projectArea?


permanent link
Ralph Schoon (60.9k33643) | answered Jun 27 '13, 6:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You can use https://rsjazz.wordpress.com/2012/12/09/analyzing-a-aroject-areas-members-and-roles-using-the-plain-java-client-libraries/ but you would need a user to log on that has enough permissions to see the data. You don't need the login of the other user.

Comments
Qin Zhang commented Jun 27 '13, 11:24 p.m.
Thanks for your reply.

You are right that I can use the methods mentioned in  https://rsjazz.wordpress.com/2012/12/09/analyzing-a-aroject-areas-members-and-roles-using-the-plain-java-client-libraries/ to get all members, administrators for a special project area and its team areas. And it is for to get all users who have read access to a project area.

Now I want to get project areas for a special user who has read access only with its username.  I have a user with username and password that has enough permissions to see the data.

If I use methods in https://rsjazz.wordpress.com/2012/12/09/analyzing-a-aroject-areas-members-and-roles-using-the-plain-java-client-libraries/ I need to deal with every project areas and its users with read access to find out a user corresponding to project areas.

I want to know if there any method to get all project areas for a special user without his/her password.

Any suggestion?

Ralph Schoon commented Jun 28 '13, 1:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

That is explained in the last section before the summary in said post. 


Ralph Schoon commented Jun 28 '13, 2:03 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Qin Zhang commented Jun 28 '13, 4:48 a.m.

 Do you mean "Only Analyze the Process Areas of One User"?  But this only can find out project areas which members contain the special user. The result is same as to log on RTC web server to view "My projects" label, I need to find out projects in "Manage All Projects" label that the user can access, which including public projects.


Qin Zhang commented Jun 28 '13, 5:09 a.m.

I need to find out all projects that the user have read access, just like he/she logged on to RTC web server then navigate to "Manage All Projects" label, all projects presented to him/her. I think "all projects" should contain:

  1. public projects which access control is "Everyone"
  2. projects whose members and administrators contain the user
  3. projects whose access list contain the user
  4. projects whose team area of members and administrators contain the user
    I want to know if there any RTC java api to realize the function.


permanent link
Ralph Schoon (60.9k33643) | answered Jun 28 '13, 5:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
"need to find out projects in "Manage All Projects" label that the user can access, which including public projects."
I have not looked at that. You would have to look how the read access is configured and who has access.
I would start looking att the code snippet below. That API was easy enough to find just looking at IProjectArea:
		IReadAccessListHandle accessListHandle=projectArea.getReadAccessList();
		IReadAccessList accessList = (IReadAccessList) teamRepository.itemManager()
		.fetchCompleteItem(accessListHandle, IItemManager.REFRESH, null);
		IContributorHandle[] readAccess = accessList.getContributors();



Comments
Ralph Schoon commented Jun 28 '13, 5:09 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

This might be only for the access control list part of the configuration. You would probably also look if the project itself is readable for everyone, no one, members of the project area hierarchy, Members of the hierarchy and the access list and use the API described in the post to find if the user you are looking for is part of it.


Qin Zhang commented Jun 28 '13, 5:33 a.m.

Yes, you are right. And I also use the method projectArea.getReadAccessList() you mentioned to get its uses in access list. 

Besides, I use projectArea.isInternalPublic() to verify it is a public project, right?
I think it is complex to find out all projects for a special user in this way. Is there a simple way just with one or two RTC java api to find out all projects that the user has access right?  
Use repository.contributorManager().fetchContributorByUserId(userId, null) will get IContributor object. Is there any way to use the IContributor object to get all projects he can access besides he is one member of some projects?


1
Ralph Schoon commented Jun 28 '13, 6:09 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I don't know, but I would not expect it to be available. As you can see from the Web UI, it shows you the teams you are member - using the API described in my blog. If you want to know all projects the user can read, you would have to look into all the others and see if there is a read restriction that excludes the user.


Qin Zhang commented Jun 28 '13, 7:09 a.m.

 Thank you very much, I will look for it...

Your answer


Register or to post your answer.