Hi, there will be examples for your use-case in the next update of our supersonic app. In the meantime you can have a look at the API documentation at https://public.api.campusonline.community/q/swagger-ui/?urls.primaryName=Auth-API%20(auth)#/Roles%20of%20identity. There should also be interfaces ready in java libraries, see pub-auth-api-*.
Example Code:
@GET
@Authenticated
@Path("/read-access-for-app-for-someone-else")
public PermissionResource getReadPermissionForAppForSomeoneElse(
@NotNull @QueryParam("org_id") String orgId,
@NotNull @QueryParam("person_uid") String personUid) {
SecuritySubject otherSubject = securitySubjectService.createForPersonUid(personUid)
.orElseThrow(() -> new BadRequestException("person not found"));
SecurityContext context = SecurityContext.withOrgId(orgId);
if (!otherSubject.hasRole(ContextRole.createRole(context, EXAMPLES_READ))) {
return new PermissionResource(PERMISSION_FOR_APP_IN_CONTEXT, false);
}
return new PermissionResource(PERMISSION_FOR_APP_IN_CONTEXT, true);
}
Cheers luke