#1 2019-06-13 13:02:28

Patryx
Member
Registered: 2019-03-25

Script - how to find all allowed reports for given user?

Hi,
I want to write a script with incoming parameters: user (username) and apikey.
In script after I find such a user with given apikey, I want to find all reports (and their variants) where such a user has permissions (for example READ, EXECUTE).
As a result of the script I want to return reports keys and it's variants keys (or maybe also permission) as json.
I see in your source code how to read from object Report: Report Properties, Metadata, Paramters etc but I cannot find how to read Permissions?
What's more permissions can be granted also by group etc.

Could you give me some advises how to find reports where user has permission (directly or indirectly by group)?

Thank you in advance.

Offline

#2 2019-06-19 09:31:34

Patryx
Member
Registered: 2019-03-25

Re: Script - how to find all allowed reports for given user?

Hi,
Can I get any hints, please?

Offline

#3 2019-06-20 16:56:57

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Script - how to find all allowed reports for given user?

Hi Patryx,

have you checked the class net.datenwerke.security.service.security.SecurityService with all the checkRights() methods ?

E.g.: net.datenwerke.security.service.security.SecurityService.checkRights(User, SecurityTarget, Class<? extends Securee>, Class<? extends Right>...)

boolean hasAccess = securityService.checkRights(yourReport, SecurityServiceSecuree.class, Execute.class);

Regards,
Eduardo

Offline

#4 2019-06-27 10:49:54

Patryx
Member
Registered: 2019-03-25

Re: Script - how to find all allowed reports for given user?

Hi Eduardo,

Should I understand if I want to get all reports for which I have permission to execute, I have to go through all reports defined in reportserver and check each one if I have access?

Offline

#5 2019-07-02 09:03:01

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Script - how to find all allowed reports for given user?

Hi Patryx,

you can use the method net.datenwerke.rs.core.service.reportmanager.ReportService.getAllReports() for this.

Regards,
Eduardo

Offline

#6 2019-07-02 10:48:48

Patryx
Member
Registered: 2019-03-25

Re: Script - how to find all allowed reports for given user?

Hi Eduardo,

Thanks. Indeed I used net.datenwerke.rs.core.service.reportmanager.ReportService.getAllReports() to achieve my goal and then I checked rights for each report for expected user etc.

Last edited by Patryx (2019-07-02 11:11:03)

Offline

Board footer

Powered by FluxBB