cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Java code for user-wise report access list

Former Member
0 Likes
524

Dear All,

I have a very big requirement and I have no idea where to begin. I only have a limited experience with SAP BI's Java SDK and has mostly used it for just generating list of all reports with their folder path or list of all users in a group.

This time though I have a big ambition (or at least I think it would be a difficult one to pull off)

What I need

Is a list of all reports with all users who has access to it and the access level they have.

It needs to have following columns

Report Name, Full Report Path, User ID (and Name if possible), Access level

I am also trying to write a code for list of reports and the user groups that has to it.


What I have

I know how to retrieve the list of all reports and I know how to retrieve list of users. But what I don't know is how to connect them or to get the access level they have.

So if anyone can help me out, it would be great. It would be even more great if I could have a ready to use code! I know it is too much to ask, but as I said I am a novice to Java part and if you give me pieces, it would take me days to stitch em up and make a full code.

So if there are any kind ones out there, please help!

Thanks.


View Entire Topic
DellSC
Active Contributor
0 Likes

This gets a little complicated because security can be assigned to specific users, but also to user gropus.  Also you have both Explicit Principals - user and groups that have been explicitly granted access to something - and Effective Principals - users and groups that have inherited access to something.  You also have to look at the access level and advanced rights assigned to determine whether they have access or whether the access has been taken away.

So, here's some potential logic for you:

- Get the list of users.  I would create a UserInfo class that has, at a minimum, the Title (User ID) and Full Name and put these in a HashMap<Integer, UserInfo> that has a key of the SI_ID for the user.

- Get the list of groups - I would create a GroupInfo class that has the group name and then a HashMap<Integer, UserInfo> of the users who are members of that group.  Then I would put these in a HashMap<Integer, GroupInfo> that has the SI_ID of the group as its key.

- Get a list of the Access Levels - I put these in a HashMap<Integer, String> that thas the SI_ID of the role/access level and its name.

- Get the list of reports.

     - For each report, walk through the ExplicitPrincipals (getSecurityInfo2().getExplicitPrincipals()).

     - For each ExplicitPrincipal, walk through the ExplicitRoles (getRoles())  to build a string of the access levels that are assigned (there can be multiple...)

     - If the ExplicitPrincipal is a group (found in your group hashmap), walk through the group's list of users and output the information.

     - If the ExplicitPrincipal is a user (found in your user hashmap), output the user info.

     - If there is no role assigned, walk through the list of ExplicitRights (getRights()) for the principal to make sure that the "View Object" right has been assigned.  If it has, output as above.

     - Repeat all of these steps for the EffectivePrincipals found in getSecurityInfo2().getEffectivePrincipals() to show folks who have inherited rights.

-Dell