19.26. haspermission

Allows to check if a given user has a given permission on a given target. Returns true if the user has the permission, else false.

The -g flag allows to check generic permissions. Documentation of these including the exact target types you can enter can be found in Section 3.2. Permission Management.

For other objects, e.g. Users, Datasources, etc., you can check the entity types here: https://reportserver.net/api/latest/entities.html.

All objects can be fetched using object resolver queries. Refer to Section 15.5. Object Resolver for more details of object resolver queries.

Valid permissions are:

  • Read
  • Write
  • Execute
  • Delete
  • GrantAccess
  • TeamSpaceAdministrator

The following example checks if the user with id 123 has Execute permission on the AccessRsSecurityTarget generic target, i.e. if the user is allowed to log in into ReportServer.

reportserver$ haspermission -g id:User:123 net.datenwerke.rs.core.service.genrights.access.AccessRsSecurityTarget Execute
reportserver$ true

The following example checks if the user with id 123 has Read permission on the datasource with id 456.

reportserver$ haspermission id:User:123 id:DatasourceDefinition:456 Read
reportserver$ false

Use: haspermission [-g] user target right