Пример #1
0
 protected void deleteComposites(List<RoleRepresentation> roles, RoleModel role) {
   for (RoleRepresentation rep : roles) {
     RoleModel composite = realm.getRoleById(rep.getId());
     if (composite == null) {
       throw new NotFoundException("Could not find composite role: " + rep.getName());
     }
     role.removeCompositeRole(composite);
   }
 }
Пример #2
0
  public static void assertRoles(List<RoleRepresentation> actual, String... expected) {
    assertEquals(expected.length, actual.size());

    for (String e : expected) {
      boolean found = false;
      for (RoleRepresentation r : actual) {
        if (r.getName().equals(e)) {
          found = true;
        }
      }
      if (!found) {
        fail("Role " + e + " not found");
      }
    }
  }
Пример #3
0
 protected void updateRole(RoleRepresentation rep, RoleModel role) {
   role.setName(rep.getName());
   role.setDescription(rep.getDescription());
 }