You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2020/02/19 16:52:01 UTC

[syncope] branch 2_1_X updated (fd6fdab -> c8ef31b)

This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a change to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git.


    from fd6fdab  Correct formatting for external links
     new 5a441bd  Cleanup Realm REST endpoints
     new c8ef31b  Bump upgrading DBMS stuff

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../syncope/common/rest/api/beans/RealmQuery.java      | 18 ++++++++++++++++++
 .../syncope/common/rest/api/service/RealmService.java  |  4 ++--
 .../java/org/apache/syncope/core/logic/RealmLogic.java | 14 +++++++++++---
 .../core/rest/cxf/service/RealmServiceImpl.java        |  2 +-
 pom.xml                                                | 16 ++++++++--------
 5 files changed, 40 insertions(+), 14 deletions(-)


[syncope] 01/02: Cleanup Realm REST endpoints

Posted by il...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit 5a441bde0f321593c15dbbddaf9389f6d5772df1
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Wed Feb 19 17:50:07 2020 +0100

    Cleanup Realm REST endpoints
---
 .../syncope/common/rest/api/beans/RealmQuery.java      | 18 ++++++++++++++++++
 .../syncope/common/rest/api/service/RealmService.java  |  4 ++--
 .../java/org/apache/syncope/core/logic/RealmLogic.java | 14 +++++++++++---
 .../core/rest/cxf/service/RealmServiceImpl.java        |  2 +-
 4 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/RealmQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/RealmQuery.java
index f32d6d7..7bdf463 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/RealmQuery.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/RealmQuery.java
@@ -36,6 +36,11 @@ public class RealmQuery implements Serializable {
             return this;
         }
 
+        public Builder base(final String base) {
+            instance.setBase(base);
+            return this;
+        }
+
         public RealmQuery build() {
             return instance;
         }
@@ -43,6 +48,8 @@ public class RealmQuery implements Serializable {
 
     private String keyword;
 
+    private String base;
+
     public String getKeyword() {
         return keyword;
     }
@@ -52,6 +59,15 @@ public class RealmQuery implements Serializable {
         this.keyword = keyword;
     }
 
+    public String getBase() {
+        return base;
+    }
+
+    @QueryParam("base")
+    public void setBase(final String base) {
+        this.base = base;
+    }
+
     @Override
     public boolean equals(final Object obj) {
         if (this == obj) {
@@ -67,6 +83,7 @@ public class RealmQuery implements Serializable {
         return new EqualsBuilder().
                 appendSuper(super.equals(obj)).
                 append(keyword, other.keyword).
+                append(base, other.base).
                 build();
     }
 
@@ -75,6 +92,7 @@ public class RealmQuery implements Serializable {
         return new HashCodeBuilder().
                 appendSuper(super.hashCode()).
                 append(keyword).
+                append(base).
                 build();
     }
 }
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
index 79cc617..7e18257 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
@@ -60,7 +60,7 @@ public interface RealmService extends JAXRSService {
 
     /**
      * Returns a list of existing realms matching the given query (not including descendant realms) and the total number
-     * of descedant realms.
+     * of descendant realms.
      *
      * @param query query conditions
      * @return list of existing realms matching the given query (not including descendant realms) and the total number
@@ -86,7 +86,7 @@ public interface RealmService extends JAXRSService {
      * Creates a new realm under the given path.
      *
      * @param parentPath full path of the parent realm
-     * @param realmTO new realm.
+     * @param realmTO new realm
      * @return Response object featuring Location header of created realm as well as the realm itself
      * enriched with propagation status information
      */
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java
index 29776a4..4bdb1c8 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java
@@ -74,11 +74,19 @@ public class RealmLogic extends AbstractTransactionalLogic<RealmTO> {
 
     @PreAuthorize("hasRole('" + StandardEntitlement.REALM_LIST + "')")
     @Transactional(readOnly = true)
-    public Pair<Integer, List<RealmTO>> search(final String keyword) {
-        Set<String> bases = AuthContextUtils.getAuthorizations().get(StandardEntitlement.REALM_LIST);
+    public Pair<Integer, List<RealmTO>> search(final String keyword, final String base) {
+        Realm baseRealm = base == null ? realmDAO.getRoot() : realmDAO.findByFullPath(base);
+        if (baseRealm == null) {
+            LOG.error("Could not find realm '" + base + "'");
+
+            throw new NotFoundException(base);
+        }
+
+        Set<String> roots = AuthContextUtils.getAuthorizations().get(StandardEntitlement.REALM_LIST).stream().
+                filter(auth -> auth.startsWith(baseRealm.getFullPath())).collect(Collectors.toSet());
 
         Set<Realm> match = realmDAO.findMatching(keyword).stream().
-                filter(realm -> bases.stream().anyMatch(base -> realm.getFullPath().startsWith(base))).
+                filter(realm -> roots.stream().anyMatch(root -> realm.getFullPath().startsWith(root))).
                 collect(Collectors.toSet());
 
         int descendants = Math.toIntExact(
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java
index c80403e..7916a20 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java
@@ -44,7 +44,7 @@ public class RealmServiceImpl extends AbstractServiceImpl implements RealmServic
     public PagedResult<RealmTO> search(final RealmQuery query) {
         String keyword = query.getKeyword() == null ? null : query.getKeyword().replace('*', '%');
 
-        Pair<Integer, List<RealmTO>> result = logic.search(keyword);
+        Pair<Integer, List<RealmTO>> result = logic.search(keyword, query.getBase());
         return buildPagedResult(result.getRight(), 1, result.getRight().size(), result.getLeft());
     }
 


[syncope] 02/02: Bump upgrading DBMS stuff

Posted by il...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit c8ef31b6681fd8eb390397ee3eb7e421ee9e571e
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Wed Feb 19 17:50:26 2020 +0100

    Bump upgrading DBMS stuff
---
 pom.xml | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/pom.xml b/pom.xml
index 45bdedf..98ecb26 100644
--- a/pom.xml
+++ b/pom.xml
@@ -539,14 +539,14 @@ under the License.
     <nodejs.version>v8.11.4</nodejs.version>    
     <protractor.version>5.4.0</protractor.version>    
 
-    <docker.postgresql.version>11.5</docker.postgresql.version>
-    <docker.mysql.version>8.0.18</docker.mysql.version>
-    <docker.mariadb.version>10.4</docker.mariadb.version>
-
-    <jdbc.postgresql.version>42.2.8</jdbc.postgresql.version>
-    <jdbc.mysql.version>8.0.18</jdbc.mysql.version>
-    <jdbc.mariadb.version>2.4.3</jdbc.mariadb.version>
-    <jdbc.mssql.version>7.4.1.jre</jdbc.mssql.version>
+    <docker.postgresql.version>11.7</docker.postgresql.version>
+    <docker.mysql.version>8.0.19</docker.mysql.version>
+    <docker.mariadb.version>10.5</docker.mariadb.version>
+
+    <jdbc.postgresql.version>42.2.10</jdbc.postgresql.version>
+    <jdbc.mysql.version>8.0.19</jdbc.mysql.version>
+    <jdbc.mariadb.version>2.5.4</jdbc.mariadb.version>
+    <jdbc.mssql.version>8.2.0.jre</jdbc.mssql.version>
 
     <adminUser>admin</adminUser>
     <anonymousUser>anonymous</anonymousUser>