Repository: syncope Updated Branches: refs/heads/2_0_X 19d9e93e0 -> 66cab5b3b
[SYNCOPE-1019] Improvements Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/66cab5b3 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/66cab5b3 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/66cab5b3 Branch: refs/heads/2_0_X Commit: 66cab5b3bdecf74a88f2b7685ba183a1aedbec63 Parents: 19d9e93 Author: skylark17 <matteo.alessandr...@tirasa.net> Authored: Mon Sep 10 16:02:11 2018 +0200 Committer: skylark17 <matteo.alessandr...@tirasa.net> Committed: Mon Sep 10 16:02:11 2018 +0200 ---------------------------------------------------------------------- .../client/enduser/resources/GroupResource.java | 26 +++++++------------- .../workingwithapachesyncope/customization.adoc | 6 ++--- 2 files changed, 12 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/66cab5b3/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 802ffdf..82884ee 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 @@ -59,12 +59,13 @@ public class GroupResource extends BaseResource { CustomTemplateInfo customTemplate = SyncopeEnduserApplication.get().getCustomTemplate(); + final GroupResponse groupResponse = new GroupResponse(); + if (customTemplate.getWizard().getSteps().containsKey("groups")) { String realm = URLDecoder.decode(attributes.getParameters().get("realm"). toString(SyncopeConstants.ROOT_REALM), "UTF-8"); StringValue term = attributes.getParameters().get("term"); - final GroupResponse groupResponse = new GroupResponse(); final int totGroups = SyncopeEnduserSession.get(). getService(SyncopeService.class).numbers().getTotalGroups(); final List<GroupTO> groupTOs = SyncopeEnduserSession.get(). @@ -80,27 +81,18 @@ public class GroupResource extends BaseResource { groups.put(groupTO.getKey(), groupTO.getName()); } groupResponse.setGroupTOs(groups); - - response.setWriteCallback(new AbstractResource.WriteCallback() { - - @Override - public void writeData(final Attributes attributes) throws IOException { - attributes.getResponse().write(MAPPER.writeValueAsString(groupResponse)); - } - }); } else { - final GroupResponse groupResponse = new GroupResponse(); groupResponse.setTotGroups(0); Map<String, String> groups = new HashMap<>(); groupResponse.setGroupTOs(groups); - response.setWriteCallback(new AbstractResource.WriteCallback() { - - @Override - public void writeData(final Attributes attributes) throws IOException { - attributes.getResponse().write(MAPPER.writeValueAsString(groupResponse)); - } - }); } + response.setWriteCallback(new AbstractResource.WriteCallback() { + + @Override + public void writeData(final Attributes attributes) throws IOException { + attributes.getResponse().write(MAPPER.writeValueAsString(groupResponse)); + } + }); response.setTextEncoding(StandardCharsets.UTF_8.name()); response.setStatusCode(Response.Status.OK.getStatusCode()); } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/syncope/blob/66cab5b3/src/main/asciidoc/reference-guide/workingwithapachesyncope/customization.adoc ---------------------------------------------------------------------- diff --git a/src/main/asciidoc/reference-guide/workingwithapachesyncope/customization.adoc b/src/main/asciidoc/reference-guide/workingwithapachesyncope/customization.adoc index ab831ec..d6527ce 100644 --- a/src/main/asciidoc/reference-guide/workingwithapachesyncope/customization.adoc +++ b/src/main/asciidoc/reference-guide/workingwithapachesyncope/customization.adoc @@ -778,9 +778,9 @@ style and structure. The `customTemplate.json` could be edited and reloaded without the need of re-starting the Java EE container. ==== -[WARNING] +[TIP] +==== The `customTemplate.json` default content is: - ``` { "templates": @@ -848,8 +848,8 @@ The `customTemplate.json` default content is: } } ``` - if such file is missing, empty or not valid, Enduser structure will not be valid and won't work as expected. +==== [discrete] ====== Editing default template