Skip to content

User groups: adding a user to a group that does not exist returns 500 #279

Description

@Fishbowler

The API documents that adding a user to a group that doesn't exist creates that group. Instead, it returns a 500 and creates nothing. UserServiceController creates the group from a GroupEntity without members or admins, and GroupController.createGroup requires those lists, so it throws a NullPointerException.

Steps to reproduce:
Either of:

  • POST /plugins/restapi/v1/users/{username}/groups/{groupName} (for an existing user and a group that doesn't exist)
  • POST /plugins/restapi/v1/users/{username}/groups (for an existing user) with body:
    <groups>
        <groupname>nonexistent</groupname>
    </groups>

Expected: 201, with the group created and the user a member of it. Actual: 500.

Seen with REST API plugin 1.12.1-SNAPSHOT (main) on Openfire 5.1.2.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions