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/20 08:35:08 UTC

[syncope] branch master updated (5ebce68 -> 8556c3e)

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

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


    from 5ebce68  Correct formatting for external links
     new 455d982  Cleanup Realm REST endpoints
     new f7159c3  Bump upgrading DBMS stuff
     new 8556c3e  Upgrading OpenJPA

The 3 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/03: 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 master
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit 455d98219a40dd7b454f57d9b8eac020536ddcea
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/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/RealmQuery.java b/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/RealmQuery.java
index f32d6d7..7bdf463 100644
--- a/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/RealmQuery.java
+++ b/common/idrepo/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/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java b/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
index 79cc617..7e18257 100644
--- a/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RealmService.java
+++ b/common/idrepo/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/idrepo/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java
index bad86d8..6db99ec 100644
--- a/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java
+++ b/core/idrepo/logic/src/main/java/org/apache/syncope/core/logic/RealmLogic.java
@@ -73,11 +73,19 @@ public class RealmLogic extends AbstractTransactionalLogic<RealmTO> {
 
     @PreAuthorize("hasRole('" + IdRepoEntitlement.REALM_LIST + "')")
     @Transactional(readOnly = true)
-    public Pair<Integer, List<RealmTO>> search(final String keyword) {
-        Set<String> bases = AuthContextUtils.getAuthorizations().get(IdRepoEntitlement.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(IdRepoEntitlement.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/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java b/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java
index c80403e..7916a20 100644
--- a/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/RealmServiceImpl.java
+++ b/core/idrepo/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] 03/03: Upgrading OpenJPA

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

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

commit 8556c3ead6da9780809f7c51d59794f924f37b98
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Thu Feb 20 09:30:02 2020 +0100

    Upgrading OpenJPA
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index d1e25e3..f4ca208 100644
--- a/pom.xml
+++ b/pom.xml
@@ -413,7 +413,7 @@ under the License.
     <spring-boot.version>2.2.4.RELEASE</spring-boot.version>
     <spring-cloud-gateway.version>2.2.1.RELEASE</spring-cloud-gateway.version>
 
-    <openjpa.version>3.1.0</openjpa.version>
+    <openjpa.version>3.1.1</openjpa.version>
     <hikaricp.version>3.4.2</hikaricp.version>
     <hibernate-validator.version>6.1.2.Final</hibernate-validator.version>
 


[syncope] 02/03: 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 master
in repository https://gitbox.apache.org/repos/asf/syncope.git

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

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

diff --git a/pom.xml b/pom.xml
index 6beff6b..d1e25e3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -523,15 +523,15 @@ under the License.
     <javax.faces.version>2.4.0</javax.faces.version>
 
     <docker.postgresql.version>12</docker.postgresql.version>
-    <docker.mysql.version>8.0.18</docker.mysql.version>
-    <docker.mariadb.version>10.4</docker.mariadb.version>
+    <docker.mysql.version>8.0.19</docker.mysql.version>
+    <docker.mariadb.version>10.5</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.1</jdbc.mariadb.version>
-    <jdbc.mssql.version>7.2.2.jre</jdbc.mssql.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>
     <jdbc.oracle.version>19.3.0.0</jdbc.oracle.version>
-    
+
     <adminUser>admin</adminUser>
     <anonymousUser>anonymous</anonymousUser>
     <adminPassword>DE088591C00CC98B36F5ADAAF7DA2B004CF7F2FE7BBB45B766B6409876E2F3DB13C7905C6AA59464</adminPassword>