You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fixes#40: persist members and admins in group updates
When creating or updating a group, the provided members and admins should not be ignored.
Note that this change will result in admins/members being removed, when an update to an existing group does not properly include the existing members and admins. Prior to this commit, no modification would have been made to the admins and members.
Copy file name to clipboardExpand all lines: changelog.html
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,7 @@ <h1>
52
52
<li>[<ahref='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/99'>#99</a>] - Fix hard-coded link to localhost for OpenAPI yaml link in docs.</li>
53
53
<li>[<ahref='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/96'>#96</a>] - Don't require auth for readiness/liveness endpoints</li>
54
54
<li>[<ahref='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/74'>#74</a>] - Return HTTP status code 404 instead of 500 when passing incorrect MUC service/room name</li>
55
+
<li>[<ahref='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/40'>#40</a>] - When creating or updating a group, use the members and admins that are provided in the input data.</li>
thrownewServiceException("Cannot parse a member value as a JID: " + newMember, groupEntity.getName(), ExceptionType.ILLEGAL_ARGUMENT_EXCEPTION, Response.Status.BAD_REQUEST, e);
116
+
}
117
+
}
118
+
for (finalStringnewAdmin : groupEntity.getAdmins()) {
thrownewServiceException("Cannot parse a admin value as a JID: " + newAdmin, groupEntity.getName(), ExceptionType.ILLEGAL_ARGUMENT_EXCEPTION, Response.Status.BAD_REQUEST, e);
123
+
}
124
+
}
125
+
126
+
// Start creating the group.
107
127
group = GroupManager.getInstance().createGroup(groupEntity.getName());
thrownewServiceException("Cannot parse a member value as a JID: " + newMember, groupEntity.getName(), ExceptionType.ILLEGAL_ARGUMENT_EXCEPTION, Response.Status.BAD_REQUEST, e);
180
+
}
181
+
}
182
+
for (finalStringnewAdmin : groupEntity.getAdmins()) {
thrownewServiceException("Cannot parse a admin value as a JID: " + newAdmin, groupEntity.getName(), ExceptionType.ILLEGAL_ARGUMENT_EXCEPTION, Response.Status.BAD_REQUEST, e);
@ApiResponse(responseCode = "400", description = "Group or group name missing, or name does not match existing group."),
97
+
@ApiResponse(responseCode = "400", description = "Group or group name missing, or name does not match existing group, or invalid syntax for a property."),
98
98
@ApiResponse(responseCode = "404", description = "Group with this name not found."),
Copy file name to clipboardExpand all lines: src/java/org/jivesoftware/openfire/plugin/rest/service/UserGroupService.java
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -59,9 +59,10 @@ public UserGroupsEntity getUserGroups(
59
59
60
60
@POST
61
61
@Operation( summary = "Add user to groups",
62
-
description = "Add a particular user to a collection of groups.",
62
+
description = "Add a particular user to a collection of groups. When a group that is provided does not exist, it will be automatically created if possible.",
63
63
responses = {
64
64
@ApiResponse(responseCode = "201", description = "The user was added to all groups."),
65
+
@ApiResponse(responseCode = "400", description = "When the username cannot be parsed into a JID.")
0 commit comments