Esempio n. 1
0
  @Override
  public Set<RoleModel> getClientRoleMappings(ClientModel app) {
    Set<RoleModel> result = new HashSet<RoleModel>();

    for (RoleModel role : allRoles) {
      RoleEntity roleEntity = ((RoleAdapter) role).getRoleEntity();
      if (app.getId().equals(roleEntity.getClientId())) {
        result.add(new RoleAdapter(realm, roleEntity, app));
      }
    }
    return result;
  }
Esempio n. 2
0
  @Override
  public Set<RoleModel> getRealmRoleMappings() {
    Set<RoleModel> allRoleMappings = getRoleMappings();

    // Filter to retrieve just realm roles TODO: Maybe improve to avoid filter programmatically...
    // Maybe have separate fields for realmRoles and appRoles on user?
    Set<RoleModel> realmRoles = new HashSet<RoleModel>();
    for (RoleModel role : allRoleMappings) {
      RoleEntity roleEntity = ((RoleAdapter) role).getRoleEntity();

      if (realm.getId().equals(roleEntity.getRealmId())) {
        realmRoles.add(role);
      }
    }
    return realmRoles;
  }