Java Code Examples for org.keycloak.representations.idm.UserRepresentation#setAccess()
The following examples show how to use
org.keycloak.representations.idm.UserRepresentation#setAccess() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UsersResource.java From keycloak with Apache License 2.0 | 6 votes |
private List<UserRepresentation> toRepresentation(RealmModel realm, UserPermissionEvaluator usersEvaluator, Boolean briefRepresentation, List<UserModel> userModels) { boolean briefRepresentationB = briefRepresentation != null && briefRepresentation; List<UserRepresentation> results = new ArrayList<>(); boolean canViewGlobal = usersEvaluator.canView(); usersEvaluator.grantIfNoPermission(session.getAttribute(UserModel.GROUPS) != null); for (UserModel user : userModels) { if (!canViewGlobal) { if (!usersEvaluator.canView(user)) { continue; } } UserRepresentation userRep = briefRepresentationB ? ModelToRepresentation.toBriefRepresentation(user) : ModelToRepresentation.toRepresentation(session, realm, user); userRep.setAccess(usersEvaluator.getAccess(user)); results.add(userRep); } return results; }
Example 2
Source File: UserResource.java From keycloak with Apache License 2.0 | 6 votes |
/** * Get representation of the user * * @return */ @GET @NoCache @Produces(MediaType.APPLICATION_JSON) public UserRepresentation getUser() { auth.users().requireView(user); UserRepresentation rep = ModelToRepresentation.toRepresentation(session, realm, user); if (realm.isIdentityFederationEnabled()) { List<FederatedIdentityRepresentation> reps = getFederatedIdentities(user); rep.setFederatedIdentities(reps); } if (session.getProvider(BruteForceProtector.class).isTemporarilyDisabled(session, realm, user)) { rep.setEnabled(false); } rep.setAccess(auth.users().getAccess(user)); return rep; }