Changed memberUsername to member in the member-role-addition web-service
Removed user-privileges from user-group list response.
Change-Id: Icc58cc4ba46cc1e58697d4fcbb5d0a65aaeac54f
diff --git a/Changes b/Changes
index 050dfc7..639a5fe 100644
--- a/Changes
+++ b/Changes
@@ -20,6 +20,10 @@
- Deprecate VC access deletion.
- Change default port to 8089.
- Disallow scope all for non super clients.
+- Changed memberUsername to member in the new member-role-addition web-service.
+- Removed user-privileges from user-group list response.
+-
+
# version 0.74.1-SNAPSHOT
diff --git a/src/main/java/de/ids_mannheim/korap/dto/UserGroupDto.java b/src/main/java/de/ids_mannheim/korap/dto/UserGroupDto.java
index b5501d4..7803c53 100644
--- a/src/main/java/de/ids_mannheim/korap/dto/UserGroupDto.java
+++ b/src/main/java/de/ids_mannheim/korap/dto/UserGroupDto.java
@@ -28,7 +28,4 @@
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<UserGroupMemberDto> members;
-
- @JsonInclude(JsonInclude.Include.NON_NULL)
- private List<PrivilegeType> userPrivileges;
}
diff --git a/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java b/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java
index 3ffa646..7fbaa10 100644
--- a/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java
+++ b/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java
@@ -27,7 +27,7 @@
public class UserGroupConverter {
public UserGroupDto createUserGroupDto (UserGroup group,
- List<UserGroupMember> members, Set<Role> roleSet) {
+ List<UserGroupMember> members) {
UserGroupDto dto = new UserGroupDto();
dto.setId(group.getId());
@@ -36,10 +36,6 @@
dto.setStatus(group.getStatus());
dto.setOwner(group.getCreatedBy());
- if (roleSet != null) {
- dto.setUserPrivileges(createPrivilegeList(roleSet));
- }
-
if (members != null) {
ArrayList<UserGroupMemberDto> memberDtos = new ArrayList<>(
members.size());
diff --git a/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java b/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
index 11e9c12..f73a9ec 100644
--- a/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
+++ b/src/main/java/de/ids_mannheim/korap/service/UserGroupService.java
@@ -93,10 +93,9 @@
UserGroupDto groupDto;
for (UserGroup group : userGroups) {
members = retrieveMembers(group.getId(), username);
- userAsMember = groupMemberDao.retrieveMemberById(username,
- group.getId());
- groupDto = converter.createUserGroupDto(group, members,
- userAsMember.getRoles());
+// userAsMember = groupMemberDao.retrieveMemberById(username,
+// group.getId());
+ groupDto = converter.createUserGroupDto(group, members);
dtos.add(groupDto);
}
@@ -141,7 +140,7 @@
.retrieveHiddenGroupByQueryName(queryName);
List<UserGroupMember> members = groupMemberDao
.retrieveMemberByGroupId(group.getId());
- return converter.createUserGroupDto(group, members, null);
+ return converter.createUserGroupDto(group, members);
}
public List<UserGroupDto> retrieveUserGroupByStatus (String username,
@@ -156,7 +155,7 @@
UserGroupDto groupDto;
for (UserGroup group : userGroups) {
members = groupMemberDao.retrieveMemberByGroupId(group.getId());
- groupDto = converter.createUserGroupDto(group, members, null);
+ groupDto = converter.createUserGroupDto(group, members);
dtos.add(groupDto);
}
return dtos;
@@ -373,7 +372,7 @@
throws KustvaktException {
UserGroup userGroup = userGroupDao.retrieveGroupByName(groupName, true);
UserGroupDto groupDto = converter.createUserGroupDto(userGroup,
- userGroup.getMembers(), null);
+ userGroup.getMembers());
return groupDto;
}
diff --git a/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java b/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
index a968946..dd39ffc 100644
--- a/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
+++ b/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
@@ -277,7 +277,7 @@
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response addAdminRole (@Context SecurityContext securityContext,
@PathParam("groupName") String groupName,
- @FormParam("memberUsername") String memberUsername) {
+ @FormParam("member") String memberUsername) {
TokenContext context = (TokenContext) securityContext
.getUserPrincipal();
try {
@@ -311,7 +311,8 @@
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response deleteMemberRoles (@Context SecurityContext securityContext,
@PathParam("groupName") String groupName,
- @FormParam("memberUsername") String memberUsername,
+ @FormParam("memberUsername") String memberUsername, // DEPRECATED
+ @FormParam("member") String member,
@FormParam("roleId") List<Integer> roleIds,
@FormParam("role") List<PredefinedRole> roles) {
TokenContext context = (TokenContext) securityContext
@@ -326,6 +327,9 @@
+ " removed in API v1.1."));
}
else {
+ memberUsername = (member!=null && !member.isEmpty())
+ ? member : memberUsername;
+
service.deleteMemberRoles(context.getUsername(), groupName,
memberUsername, roles);
}
diff --git a/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupTestBase.java b/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupTestBase.java
index 630ee66..82568c0 100644
--- a/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupTestBase.java
+++ b/src/test/java/de/ids_mannheim/korap/web/controller/usergroup/UserGroupTestBase.java
@@ -90,7 +90,7 @@
protected Response addAdminRole (String groupName, String memberName,
String addedBy) throws KustvaktException {
Form form = new Form();
- form.param("memberUsername", memberName);
+ form.param("member", memberName);
form.param("role", PredefinedRole.GROUP_ADMIN.name());
Response response = target().path(API_VERSION).path("group")