You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by sk...@apache.org on 2017/12/15 15:36:17 UTC
syncope git commit: Improvement to REST request for Groups list
retrieving from Enduser UI
Repository: syncope
Updated Branches:
refs/heads/2_0_X 850934a6a -> 1e9ed5f79
Improvement to REST request for Groups list retrieving from Enduser UI
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/1e9ed5f7
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/1e9ed5f7
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/1e9ed5f7
Branch: refs/heads/2_0_X
Commit: 1e9ed5f79c4ebc186de640057581f2c7ee7eb383
Parents: 850934a
Author: skylark17 <ma...@tirasa.net>
Authored: Fri Dec 15 16:34:49 2017 +0100
Committer: skylark17 <ma...@tirasa.net>
Committed: Fri Dec 15 16:35:55 2017 +0100
----------------------------------------------------------------------
.../client/enduser/resources/GroupResource.java | 17 ++++++++++++-----
.../resources/app/js/controllers/UserController.js | 4 ++--
2 files changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/1e9ed5f7/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java
index 5ba4e5f..603026f 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java
@@ -22,7 +22,9 @@ import java.io.IOException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -67,7 +69,12 @@ public class GroupResource extends BaseResource {
1,
30).getResult();
groupResponse.setTotGroups(totGroups);
- groupResponse.setGroupTOs(groupTOs);
+
+ HashMap<String, String> groups = new HashMap<>();
+ for (GroupTO groupTO : groupTOs) {
+ groups.put(groupTO.getKey(), groupTO.getName());
+ }
+ groupResponse.setGroupTOs(groups);
response.setTextEncoding(StandardCharsets.UTF_8.name());
response.setWriteCallback(new AbstractResource.WriteCallback() {
@@ -91,15 +98,15 @@ public class GroupResource extends BaseResource {
private class GroupResponse {
- private List<GroupTO> groups;
+ private Map<String, String> groups;
private int totGroups;
- public List<GroupTO> getGroupTOs() {
- return Collections.unmodifiableList(groups);
+ public Map<String, String> getGroupTOs() {
+ return Collections.unmodifiableMap(groups);
}
- public void setGroupTOs(final List<GroupTO> groups) {
+ public void setGroupTOs(final Map<String, String> groups) {
this.groups = groups;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1e9ed5f7/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
index b29654b..d682cde 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
@@ -235,8 +235,8 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
$scope.dynamicForm.totGroups = response.totGroups;
for (var i in response.groupTOs) {
newGroups.push({
- "groupKey": response["groupTOs"][i].key,
- "groupName": response["groupTOs"][i].name
+ "groupKey": i,
+ "groupName": response["groupTOs"][i]
});
}
newGroups.sort(function (a, b) {