public Set<RoleModel> getScopeMappings() { if (updated != null) return updated.getScopeMappings(); Set<RoleModel> roles = new HashSet<RoleModel>(); for (String id : cached.getScope()) { roles.add(cacheSession.getRoleById(id, getRealm())); } return roles; }
@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 Set<RoleModel> getRealmScopeMappings() { Set<RoleModel> roleMappings = getScopeMappings(); Set<RoleModel> appRoles = new HashSet<RoleModel>(); for (RoleModel role : roleMappings) { RoleContainerModel container = role.getContainer(); if (container instanceof RealmModel) { if (((RealmModel) container).getId().equals(cachedRealm.getId())) { appRoles.add(role); } } } return appRoles; }
@Override public Set<RoleModel> getClientScopeMappings(ClientModel client) { Set<RoleModel> roleMappings = client.getScopeMappings(); Set<RoleModel> appRoles = new HashSet<RoleModel>(); for (RoleModel role : roleMappings) { RoleContainerModel container = role.getContainer(); if (container instanceof RealmModel) { } else { ClientModel app = (ClientModel) container; if (app.getId().equals(getId())) { appRoles.add(role); } } } return appRoles; }