syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmarte...@apache.org
Subject svn commit: r1428740 - in /syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console: pages/panels/PoliciesPanel.java pages/panels/ResourceSecurityPanel.java pages/panels/RoleSecurityPanel.java rest/PolicyRestClient.java
Date Fri, 04 Jan 2013 08:10:05 GMT
Author: fmartelli
Date: Fri Jan  4 08:10:04 2013
New Revision: 1428740

URL: http://svn.apache.org/viewvc?rev=1428740&view=rev
Log:
Fixes SYNCOPE-255

Modified:
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/PoliciesPanel.java
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceSecurityPanel.java
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSecurityPanel.java
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/rest/PolicyRestClient.java

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/PoliciesPanel.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/PoliciesPanel.java?rev=1428740&r1=1428739&r2=1428740&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/PoliciesPanel.java
(original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/PoliciesPanel.java
Fri Jan  4 08:10:04 2013
@@ -282,13 +282,13 @@ public class PoliciesPanel extends Panel
 
         @Override
         public int size() {
-            return policyRestClient.getPolicies(policyType).size();
+            return policyRestClient.getPolicies(policyType, true).size();
         }
 
         @Override
         public Iterator<PolicyTO> iterator(final int first, final int count) {
 
-            final List<PolicyTO> policies = policyRestClient.getPolicies(policyType);
+            final List<PolicyTO> policies = policyRestClient.getPolicies(policyType,
true);
 
             Collections.sort(policies, comparator);
 

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceSecurityPanel.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceSecurityPanel.java?rev=1428740&r1=1428739&r2=1428740&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceSecurityPanel.java
(original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceSecurityPanel.java
Fri Jan  4 08:10:04 2013
@@ -69,7 +69,7 @@ public class ResourceSecurityPanel exten
             @Override
             protected Map<Long, String> load() {
                 Map<Long, String> res = new HashMap<Long, String>();
-                for (PolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PASSWORD))
{
+                for (PolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PASSWORD,
false)) {
                     res.put(policyTO.getId(), policyTO.getDescription());
                 }
                 return res;
@@ -83,7 +83,7 @@ public class ResourceSecurityPanel exten
             @Override
             protected Map<Long, String> load() {
                 Map<Long, String> res = new HashMap<Long, String>();
-                for (PolicyTO policyTO : policyRestClient.getPolicies(PolicyType.ACCOUNT))
{
+                for (PolicyTO policyTO : policyRestClient.getPolicies(PolicyType.ACCOUNT,
false)) {
                     res.put(policyTO.getId(), policyTO.getDescription());
                 }
                 return res;
@@ -97,7 +97,7 @@ public class ResourceSecurityPanel exten
             @Override
             protected Map<Long, String> load() {
                 Map<Long, String> res = new HashMap<Long, String>();
-                for (PolicyTO policyTO : policyRestClient.getPolicies(PolicyType.SYNC)) {
+                for (PolicyTO policyTO : policyRestClient.getPolicies(PolicyType.SYNC, false))
{
                     res.put(policyTO.getId(), policyTO.getDescription());
                 }
                 return res;

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSecurityPanel.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSecurityPanel.java?rev=1428740&r1=1428739&r2=1428740&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSecurityPanel.java
(original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSecurityPanel.java
Fri Jan  4 08:10:04 2013
@@ -69,7 +69,7 @@ public class RoleSecurityPanel extends P
             @Override
             protected Map<Long, String> load() {
                 Map<Long, String> res = new HashMap<Long, String>();
-                for (PolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PASSWORD))
{
+                for (PolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PASSWORD,
false)) {
                     res.put(policyTO.getId(), policyTO.getDescription());
                 }
                 return res;
@@ -83,7 +83,7 @@ public class RoleSecurityPanel extends P
             @Override
             protected Map<Long, String> load() {
                 Map<Long, String> res = new HashMap<Long, String>();
-                for (PolicyTO policyTO : policyRestClient.getPolicies(PolicyType.ACCOUNT))
{
+                for (PolicyTO policyTO : policyRestClient.getPolicies(PolicyType.ACCOUNT,
false)) {
                     res.put(policyTO.getId(), policyTO.getDescription());
                 }
                 return res;

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/rest/PolicyRestClient.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/rest/PolicyRestClient.java?rev=1428740&r1=1428739&r2=1428740&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/rest/PolicyRestClient.java
(original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/rest/PolicyRestClient.java
Fri Jan  4 08:10:04 2013
@@ -80,7 +80,7 @@ public class PolicyRestClient extends Ab
         return policy;
     }
 
-    public <T extends PolicyTO> List<T> getPolicies(final PolicyType type) {
+    public <T extends PolicyTO> List<T> getPolicies(final PolicyType type, final
boolean includeGlobal) {
         final List<T> res = new ArrayList<T>();
 
         T[] policies = null;
@@ -122,6 +122,21 @@ public class PolicyRestClient extends Ab
                 res.addAll(Arrays.asList(policies));
             }
 
+            if (includeGlobal) {
+                PolicyTO globalPolicy = null;
+
+                try {
+                    globalPolicy = (T) SyncopeSession.get().getRestTemplate().getForObject(
+                            baseURL + "policy/" + policy + "/global/read", globalReference);
+                } catch (Exception ignore) {
+                    LOG.warn("No global policy found", ignore);
+                }
+
+                if (globalPolicy != null) {
+                    res.add(0, (T) globalPolicy);
+                }
+            }
+
         } catch (Exception ignore) {
             LOG.error("No policy found", ignore);
         }



Mime
View raw message