How to programmatically get all streams that user has access to? (server side)
3 answers
That is, consider a stream X owned by team area Y whose visibility is set to be private to the team area. If I ask the server to return the list of streams owned by team area Y, it will not return stream X if I am not a member of team area Y.
I don't think it would be that easy. I am not sure how to approach this. You would have to evaluate which roles in which team areas a user has and then, from the ownership and the visibility of a stream deduce if the user has access to it.
This is certainly going to be complex. If you are logged in as a user you could get all the streams and would only get the ones you have read access to, I believe. The permission aware API should only show these.
Comments
There must to exist some internal function that does that. Because it is just what we see in IDE Client when we expand "Source Control" item, a list of streams that are visible to the user.
If your use case would be clearer, there might be ways. However, the API that shows the views works with a certain user being logged in and provided him with what he can see. If you want to do the same with a different user being logged in (to create a report) it is an entirely different approach that could be very hard. See http://rsjazz.wordpress.com/2013/09/24/managing-workspaces-streams-and-components-using-the-plain-java-client-libraries/ for some clues - however, this is client code.
'https://jazzserver/ccm/rpt/repository/scm?size=600&fields=scm/workspace[stream=true]/name'
'https://jazzserver/ccm/rpt/repository/scm?size=900&fields=scm/component/*'
Comments
I would be interested in the solution to that use case too. However, I don't have the time currently to look into it.
I would look into Java Value Provider https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/. The issue here is that you only have the IWorkItemCommon interface. This leads to AudibleCommon. As getPeer() is deprecated, I don't know how to get to the SCM service. Also, as this has to run in the server as well as in the client,it would have to run on common interfaces only.