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 2018/05/07 15:23:23 UTC

[2/2] syncope git commit: [SYNCOPE-1308] Now working fine with latest PostgreSQL (needs dedicated views.xml)

[SYNCOPE-1308] Now working fine with latest PostgreSQL (needs dedicated views.xml)


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/7cdeb5fa
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/7cdeb5fa
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/7cdeb5fa

Branch: refs/heads/master
Commit: 7cdeb5fa8aaae5e39e2453e7bd9fe057afc886b4
Parents: c40ebf0
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon May 7 17:22:27 2018 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon May 7 17:23:10 2018 +0200

----------------------------------------------------------------------
 deb/core/pom.xml                                |   8 +
 fit/core-reference/pom.xml                      |  11 +
 .../src/main/resources/postgres/views.xml       | 254 +++++++++++++++++++
 .../systemadministration/dbms.adoc              |  18 ++
 4 files changed, 291 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/7cdeb5fa/deb/core/pom.xml
----------------------------------------------------------------------
diff --git a/deb/core/pom.xml b/deb/core/pom.xml
index a17d476..ac1059d 100644
--- a/deb/core/pom.xml
+++ b/deb/core/pom.xml
@@ -201,6 +201,14 @@ under the License.
         <filtering>true</filtering>
       </resource>
       <resource>
+        <directory>${basedir}/../../fit/core-reference/src/main/resources/postgres</directory>
+        <includes>
+          <include>views.xml</include>
+        </includes>
+        <targetPath>${project.build.directory}/etc</targetPath>
+        <filtering>true</filtering>
+      </resource>
+      <resource>
         <directory>${project.basedir}/../../ext/saml2sp/logic/src/main/resources</directory>
         <includes>
           <include>saml2sp-logic.properties</include>

http://git-wip-us.apache.org/repos/asf/syncope/blob/7cdeb5fa/fit/core-reference/pom.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/pom.xml b/fit/core-reference/pom.xml
index 9b5d717..77c8b74 100644
--- a/fit/core-reference/pom.xml
+++ b/fit/core-reference/pom.xml
@@ -561,6 +561,7 @@ under the License.
             <filtering>true</filtering>
             <excludes>
               <exclude>provisioning.properties</exclude>
+              <exclude>views.xml</exclude>
             </excludes>
           </resource>
           <resource>
@@ -568,6 +569,16 @@ under the License.
             <filtering>true</filtering>
           </resource>
         </resources>
+        <!-- Views need to be customized, so the PostgreSQL-specific views.xml need to be copied to target/test-classes,
+        e.g. the conf directory, in order to override classpath:views.xml -->
+        <testResources>
+          <testResource>
+            <directory>src/main/resources/postgres</directory>
+            <includes>
+              <include>views.xml</include>
+            </includes>            
+          </testResource>
+        </testResources>
       </build>
     </profile>
     

http://git-wip-us.apache.org/repos/asf/syncope/blob/7cdeb5fa/fit/core-reference/src/main/resources/postgres/views.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/postgres/views.xml b/fit/core-reference/src/main/resources/postgres/views.xml
new file mode 100644
index 0000000..1427872
--- /dev/null
+++ b/fit/core-reference/src/main/resources/postgres/views.xml
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+<properties>
+  
+  <entry key="UDynGroupMembers">
+    CREATE TABLE UDynGroupMembers(
+    any_id CHAR(36),
+    group_id CHAR(36),
+    UNIQUE(any_id, group_id))
+  </entry>
+  <entry key="ADynGroupMembers">
+    CREATE TABLE ADynGroupMembers(
+    anyType_id VARCHAR(255),
+    any_id CHAR(36),
+    group_id CHAR(36),
+    UNIQUE(anyType_id, any_id, group_id))
+  </entry>
+  <entry key="DynRoleMembers">
+    CREATE TABLE DynRoleMembers(
+    any_id CHAR(36),
+    role_id VARCHAR(255),
+    UNIQUE(any_id, role_id))
+  </entry>
+  <entry key="DynRealmMembers">
+    CREATE TABLE DynRealmMembers(
+    any_id CHAR(36),
+    dynRealm_id VARCHAR(255),
+    UNIQUE(any_id, dynRealm_id))
+  </entry>
+
+  <!-- user -->
+  <entry key="user_search">
+    CREATE VIEW user_search AS
+ 
+    SELECT u.id as any_id, u.* FROM SyncopeUser u
+  </entry>
+  <entry key="user_search_unique_attr">
+    CREATE VIEW user_search_unique_attr AS
+
+    SELECT ua.owner_id AS any_id,
+    ua.schema_id AS schema_id,
+    uav.booleanvalue AS booleanvalue,
+    uav.datevalue AS datevalue,
+    uav.doublevalue AS doublevalue,
+    uav.longvalue AS longvalue,
+    uav.stringvalue AS stringvalue
+    FROM UPlainAttrUniqueValue uav, UPlainAttr ua
+    WHERE uav.attribute_id = ua.id
+  </entry>
+  <entry key="user_search_attr">
+    CREATE VIEW user_search_attr AS
+
+    SELECT ua.owner_id AS any_id,
+    ua.schema_id AS schema_id,
+    uav.booleanvalue AS booleanvalue,
+    uav.datevalue AS datevalue,
+    uav.doublevalue AS doublevalue,
+    uav.longvalue AS longvalue,
+    uav.stringvalue AS stringvalue
+    FROM UPlainAttrValue uav, UPlainAttr ua
+    WHERE uav.attribute_id = ua.id
+  </entry>
+  <entry key="user_search_null_attr">
+    CREATE VIEW user_search_null_attr AS
+
+    SELECT u.id AS any_id,
+    PlainSchema.id AS schema_id,
+    NULL::int4 AS booleanvalue,
+    NULL::timestamp AS datevalue,
+    NULL::float8 AS doublevalue,
+    NULL::int8 AS longvalue,
+    NULL AS stringvalue
+    FROM SyncopeUser u CROSS JOIN PlainSchema
+    LEFT OUTER JOIN UPlainAttr ua ON (PlainSchema.id = ua.schema_id AND ua.owner_id = u.id)
+    WHERE ua.id IS NULL
+  </entry>
+  <entry key="user_search_urelationship">
+    CREATE VIEW user_search_urelationship AS
+
+    SELECT m.user_id AS any_id, m.anyObject_id AS right_any_id, m.type_id AS type
+    FROM URelationship m
+  </entry>
+  <entry key="user_search_umembership">
+    CREATE VIEW user_search_umembership AS
+
+    SELECT m.user_id AS any_id, g.id AS group_id, g.name AS group_name
+    FROM UMembership m, SyncopeGroup g
+    WHERE m.group_id = g.id
+  </entry>
+  <entry key="user_search_role">
+    CREATE VIEW user_search_role AS
+
+    SELECT ss.user_id AS any_id, ss.role_id AS role_id
+    FROM SyncopeUser_SyncopeRole ss
+  </entry>
+  <entry key="user_search_resource">
+    CREATE VIEW user_search_resource AS
+
+    SELECT st.user_id AS any_id, st.resource_id AS resource_id
+    FROM SyncopeUser_ExternalResource st
+  </entry>
+  <entry key="user_search_group_res">
+    CREATE VIEW user_search_group_res AS
+
+    SELECT m.user_id AS any_id, st.resource_id AS resource_id
+    FROM UMembership m, SyncopeGroup r, SyncopeGroup_ExternalResource st
+    WHERE m.group_id = r.id AND st.group_id = r.id
+  </entry>
+
+  <!-- anyObject -->
+  <entry key="anyObject_search">
+    CREATE VIEW anyObject_search AS
+ 
+    SELECT a.id as any_id, a.* FROM AnyObject a
+  </entry>
+  <entry key="anyObject_search_unique_attr">
+    CREATE VIEW anyObject_search_unique_attr AS
+
+    SELECT ua.owner_id AS any_id,
+    ua.schema_id AS schema_id,
+    uav.booleanvalue AS booleanvalue,
+    uav.datevalue AS datevalue,
+    uav.doublevalue AS doublevalue,
+    uav.longvalue AS longvalue,
+    uav.stringvalue AS stringvalue
+    FROM APlainAttrUniqueValue uav, APlainAttr ua
+    WHERE uav.attribute_id = ua.id
+  </entry>
+  <entry key="anyObject_search_attr">
+    CREATE VIEW anyObject_search_attr AS
+
+    SELECT ua.owner_id AS any_id,
+    ua.schema_id AS schema_id,
+    uav.booleanvalue AS booleanvalue,
+    uav.datevalue AS datevalue,
+    uav.doublevalue AS doublevalue,
+    uav.longvalue AS longvalue,
+    uav.stringvalue AS stringvalue
+    FROM APlainAttrValue uav, APlainAttr ua
+    WHERE uav.attribute_id = ua.id
+  </entry>
+  <entry key="anyObject_search_null_attr">
+    CREATE VIEW anyObject_search_null_attr AS
+
+    SELECT u.id AS any_id,
+    PlainSchema.id AS schema_id,
+    NULL::int4 AS booleanvalue,
+    NULL::timestamp AS datevalue,
+    NULL::float8 AS doublevalue,
+    NULL::int8 AS longvalue,
+    NULL AS stringvalue
+    FROM AnyObject u CROSS JOIN PlainSchema
+    LEFT OUTER JOIN APlainAttr ua ON (PlainSchema.id = ua.schema_id AND ua.owner_id = u.id)
+    WHERE ua.id IS NULL
+  </entry>
+  <entry key="anyObject_search_arelationship">
+    CREATE VIEW anyObject_search_arelationship AS
+
+    SELECT m.left_anyObject_id AS any_id, m.right_anyObject_id AS right_any_id, m.type_id AS type
+    FROM ARelationship m
+  </entry>
+  <entry key="anyObject_search_amembership">
+    CREATE VIEW anyObject_search_amembership AS
+
+    SELECT m.anyObject_id AS any_id, g.id AS group_id, g.name AS group_name
+    FROM AMembership m, SyncopeGroup g
+    WHERE m.group_id = g.id
+  </entry>
+  <entry key="anyObject_search_resource">
+    CREATE VIEW anyObject_search_resource AS
+
+    SELECT st.anyObject_id AS any_id, st.resource_id AS resource_id
+    FROM AnyObject_ExternalResource st
+  </entry>
+  <entry key="anyObject_search_group_res">
+    CREATE VIEW anyObject_search_group_res AS
+
+    SELECT m.anyObject_id AS any_id, st.resource_id AS resource_id
+    FROM AMembership m, SyncopeGroup r, SyncopeGroup_ExternalResource st
+    WHERE m.group_id = r.id AND st.group_id = r.id
+  </entry>
+
+  <!-- group -->
+  <entry key="group_search">
+    CREATE VIEW group_search AS
+ 
+    SELECT r.id as any_id, r.* FROM SyncopeGroup r
+  </entry>
+  <entry key="group_search_unique_attr">
+    CREATE VIEW group_search_unique_attr AS
+
+    SELECT ua.owner_id AS any_id,
+    ua.schema_id AS schema_id,
+    uav.booleanvalue AS booleanvalue,
+    uav.datevalue AS datevalue,
+    uav.doublevalue AS doublevalue,
+    uav.longvalue AS longvalue,
+    uav.stringvalue AS stringvalue
+    FROM GPlainAttrUniqueValue uav, GPlainAttr ua
+    WHERE uav.attribute_id = ua.id
+  </entry>
+  <entry key="group_search_attr">
+    CREATE VIEW group_search_attr AS
+
+    SELECT ua.owner_id AS any_id,
+    ua.schema_id AS schema_id,
+    uav.booleanvalue AS booleanvalue,
+    uav.datevalue AS datevalue,
+    uav.doublevalue AS doublevalue,
+    uav.longvalue AS longvalue,
+    uav.stringvalue AS stringvalue
+    FROM GPlainAttrValue uav, GPlainAttr ua
+    WHERE uav.attribute_id = ua.id
+  </entry>
+  <entry key="group_search_null_attr">
+    CREATE VIEW group_search_null_attr AS
+
+    SELECT u.id AS any_id,
+    PlainSchema.id AS schema_id,
+    NULL::int4 AS booleanvalue,
+    NULL::timestamp AS datevalue,
+    NULL::float8 AS doublevalue,
+    NULL::int8 AS longvalue,
+    NULL AS stringvalue
+    FROM SyncopeGroup u CROSS JOIN PlainSchema
+    LEFT OUTER JOIN GPlainAttr ua ON (PlainSchema.id = ua.schema_id AND ua.owner_id = u.id)
+    WHERE ua.id IS NULL
+  </entry>
+  <entry key="group_search_resource">
+    CREATE VIEW group_search_resource AS
+
+    SELECT st.group_id AS any_id, st.resource_id AS resource_id
+    FROM SyncopeGroup_ExternalResource st
+  </entry>
+
+</properties>

http://git-wip-us.apache.org/repos/asf/syncope/blob/7cdeb5fa/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/dbms.adoc
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/dbms.adoc b/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/dbms.adoc
index 24fb944..0a29ab0 100644
--- a/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/dbms.adoc
+++ b/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/dbms.adoc
@@ -47,6 +47,15 @@ Master.orm=META-INF/spring-orm.xml
 This assumes that you have a PostgreSQL instance running on localhost, listening on its default port 5432 with a
 database `syncope` fully accessible by user `syncope` with password `syncope`.
 
+Download
+ifeval::["{snapshotOrRelease}" == "release"]
+https://github.com/apache/syncope/blob/syncope-{docVersion}/fit/core-reference/src/main/resources/postgres/views.xml[views.xml^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "snapshot"]
+https://github.com/apache/syncope/tree/master/fit/core-reference/src/main/resources/postgres/views.xml[views.xml^]
+endif::[]
+and save it under `core/src/main/resources/`.
+
 ===== MySQL
 
 In `provisioning.properties`:
@@ -167,3 +176,12 @@ Master.audit.sql=audit_sqlserver.sql
 [WARNING]
 This assumes that you have a MS SQL Server instance running on localhost, listening on its default port 1344 with a
 database `syncope` fully accessible by user `syncope` with password `syncope`.
+
+Download
+ifeval::["{snapshotOrRelease}" == "release"]
+https://github.com/apache/syncope/blob/syncope-{docVersion}/fit/core-reference/src/main/resources/sqlserver/views.xml[views.xml^]
+endif::[]
+ifeval::["{snapshotOrRelease}" == "snapshot"]
+https://github.com/apache/syncope/tree/master/fit/core-reference/src/main/resources/sqlserver/views.xml[views.xml^]
+endif::[]
+and save it under `core/src/main/resources/`.