@Override public Set<RoleModel> getRoles() { if (updated != null) return updated.getRoles(); Set<RoleModel> roles = new HashSet<RoleModel>(); for (String id : cached.getRoles().values()) { RoleModel roleById = cacheSession.getRoleById(id, cachedRealm); if (roleById == null) continue; roles.add(roleById); } return roles; }
public static ClientRemovedEvent create(ClientModel client) { ClientRemovedEvent event = new ClientRemovedEvent(); event.realmId = client.getRealm().getId(); event.clientUuid = client.getId(); event.clientId = client.getClientId(); event.clientRoles = new HashMap<>(); for (RoleModel clientRole : client.getRoles()) { event.clientRoles.put(clientRole.getId(), clientRole.getName()); } return event; }
for (RoleModel role : client.getRoles()) {
@Override public boolean removeClient(String id, RealmModel realm) { ClientModel client = getClientById(id, realm); if (client == null) return false; invalidateClient(client.getId()); // this is needed so that a client that hasn't been committed isn't cached in a query listInvalidations.add(realm.getId()); invalidationEvents.add(ClientRemovedEvent.create(client)); cache.clientRemoval(realm.getId(), id, client.getClientId(), invalidations); for (RoleModel role : client.getRoles()) { roleRemovalInvalidations(role.getId(), role.getName(), client.getId()); } return getRealmDelegate().removeClient(id, realm); }
@Override public void preRemove(RealmModel realm, ClientModel client) { // Remove all role mappings and consents mapped to all roles of this client for (RoleModel role : client.getRoles()) { preRemove(realm, role); } // Finally remove all consents of this client DBObject query = new QueryBuilder() .and("clientId").is(client.getId()) .get(); getMongoStore().removeEntities(MongoUserConsentEntity.class, query, false, invocationContext); }
Set<RoleModel> currentAppRoles = client.getRoles(); List<RoleRepresentation> currentAppRoleReps = exportRoles(currentAppRoles); clientRolesReps.put(client.getClientId(), currentAppRoleReps);
directAccessGrantsEnabled = model.isDirectAccessGrantsEnabled(); serviceAccountsEnabled = model.isServiceAccountsEnabled(); for (RoleModel role : model.getRoles()) { roles.put(role.getName(), role.getId()); cache.addCachedRole(new CachedClientRole(id, role, realm));
for (RoleModel clientRole : client.getRoles()) { clientRole.setScopeParamRequired(false);