Uploaded image for project: 'RH-SSO'
  1. RH-SSO
  2. RHSSO-2345

Update the REST API and make "name" mandatory on GroupRepresentation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • RH-SSO-7.6.0
    • Server
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • Documentation (Ref Guide, User Guide, etc.), Release Notes, Migration

      You were able to update a group using the REST API without the name on RH-SSO 7.4.x, however on 7.6.x that isn't possible, since the same become mandatory, according to the code [1]:

      /**
           * Update group, ignores subgroups.
           *
           * @param rep
           */
          @PUT
          @Consumes(MediaType.APPLICATION_JSON)
          public Response updateGroup(GroupRepresentation rep) {
              this.auth.groups().requireManage(group);

              String groupName = rep.getName();
              if (ObjectUtil.isBlank(groupName))

      {             return ErrorResponse.error("Group name is missing", Response.Status.BAD_REQUEST);         }

              if (!Objects.equals(groupName, group.getName())) {
                  boolean exists = siblings().filter(s -> !Objects.equals(s.getId(), group.getId()))
                          .anyMatch(s -> Objects.equals(s.getName(), groupName));
                  if (exists)

      {                 return ErrorResponse.exists("Sibling group named '" + groupName + "' already exists.");             }

              }
              
              updateGroup(rep, group)

      adminEvent.operation(OperationType.UPDATE).resourcePath(session.getContext().getUri()).representation(rep).success();
              
              return Response.noContent().build();
          }

       

      But, the API Documentation still saying that "name" is optional [2]

       

      [1] https://github.com/keycloak/keycloak/blob/ef47eee2dda29a0f08187ae67970323c28947f11/services/src/main/java/org/keycloak/services/resources/admin/GroupResource.java#L99

      [2]https://access.redhat.com/webassets/avalon/d/red-hat-single-sign-on/version-7.6/rest-api/#_grouprepresentation

              Unassigned Unassigned
              rhn-support-pesilva Pedro Silva
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: