Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add some Oracle compatibility #43

Merged
merged 3 commits into from

2 participants

@kissifrot

This adds some Oracle compatibility, as oci sql scripts do not exist in Jelix. Also updated the dao to take into account tat '' equals NULL in Oracle.

@laurentj
Owner

If '' is equals to Null, why add the isnull condition ? We should add tests to verify that it does not break something in jacl2db. See jacl2.main_api.. and others jacl2.. tests

@kissifrot

Because when you insert '' it equals inserting null for Oracle, hence the added conditions. But when selecting '', Oracle won't convert it to null automatically, and so won't find anything.
Tested also on MySQL, it doesn't break jacl2db.

@laurentj laurentj merged commit 11d63d7 into jelix:jelix-1.3.x
@laurentj
Owner

ok thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
32 lib/jelix-modules/jacl2db/daos/jacl2rights.dao.xml
@@ -15,21 +15,30 @@
<parameter name="groups" />
<conditions >
<eq property="id_aclsbj" expr="$subject" />
- <eq property="id_aclres" expr="''"/>
+ <conditions logic="OR">
+ <eq property="id_aclres" expr="''"/>
+ <isnull property="id_aclres"/>
+ </conditions>
<in property="id_aclgrp" expr="$groups" />
</conditions>
</method>
<method name="getRightsByGroups" type="select">
<parameter name="groups" />
<conditions >
- <eq property="id_aclres" expr="''"/>
+ <conditions logic="OR">
+ <eq property="id_aclres" expr="''"/>
+ <isnull property="id_aclres"/>
+ </conditions>
<in property="id_aclgrp" expr="$groups" />
</conditions>
</method>
<method name="getRightsByGroup" type="select">
<parameter name="group" />
<conditions >
- <eq property="id_aclres" expr="''"/>
+ <conditions logic="OR">
+ <eq property="id_aclres" expr="''"/>
+ <isnull property="id_aclres"/>
+ </conditions>
<eq property="id_aclgrp" expr="$group" />
</conditions>
</method>
@@ -50,6 +59,7 @@
<parameter name="group" />
<conditions >
<neq property="id_aclres" expr="''" />
+ <isnotnull property="id_aclres"/>
<eq property="id_aclgrp" expr="$group" />
</conditions>
<order>
@@ -60,7 +70,10 @@
<parameter name="subject" />
<conditions >
<eq property="id_aclsbj" expr="$subject" />
- <eq property="id_aclres" expr="''"/>
+ <conditions logic="OR">
+ <eq property="id_aclres" expr="''"/>
+ <isnull property="id_aclres"/>
+ </conditions>
<eq property="id_aclgrp" value="__anonymous" />
</conditions>
</method>
@@ -75,7 +88,10 @@
</method>
<method name="getAllAnonymousRights" type="select">
<conditions >
- <eq property="id_aclres" expr="''"/>
+ <conditions logic="OR">
+ <eq property="id_aclres" expr="''"/>
+ <isnull property="id_aclres"/>
+ </conditions>
<eq property="id_aclgrp" value="__anonymous" />
</conditions>
</method>
@@ -105,7 +121,10 @@
<conditions>
<eq property="id_aclgrp" expr="$group" />
<in property="id_aclsbj" expr="$subjects" />
- <eq property="id_aclres" expr="''"/>
+ <conditions logic="OR">
+ <eq property="id_aclres" expr="''"/>
+ <isnull property="id_aclres"/>
+ </conditions>
</conditions>
</method>
<method name="deleteRightsOnResource" type="delete">
@@ -115,6 +134,7 @@
<eq property="id_aclgrp" expr="$group" />
<in property="id_aclsbj" expr="$subjects" />
<neq property="id_aclres" expr="''"/>
+ <isnotnull property="id_aclres"/>
</conditions>
</method>
</factory>
View
54 lib/jelix-modules/jacl2db/install/install_jacl2.schema.oci.sql
@@ -0,0 +1,54 @@
+--
+-- Oracle database dump
+--
+
+-- TODO : Drop tables if existing
+
+CREATE TABLE %%PREFIX%%JACL2_GROUP (
+ ID_ACLGRP VARCHAR2(50 CHAR) NOT NULL,
+ NAME VARCHAR2(150 CHAR) NOT NULL,
+ GROUPTYPE NUMBER(3,0) NOT NULL,
+ OWNERLOGIN VARCHAR2(50 CHAR),
+ CONSTRAINT %%PREFIX%%JACL2_GROUP_PK PRIMARY KEY (ID_ACLGRP)
+);
+
+CREATE TABLE %%PREFIX%%JACL2_RIGHTS (
+ ID_ACLSBJ VARCHAR2(255 CHAR) NOT NULL,
+ ID_ACLGRP VARCHAR2(50 CHAR) NOT NULL,
+ ID_ACLRES VARCHAR2(100 CHAR) DEFAULT NULL,
+ CANCELED NUMBER(3,0) DEFAULT '0',
+ CONSTRAINT %%PREFIX%%JACL2_RIGHTS_PK PRIMARY KEY (ID_ACLSBJ, ID_ACLGRP)
+);
+
+CREATE TABLE %%PREFIX%%JACL2_SUBJECT (
+ ID_ACLSBJ VARCHAR2(100 CHAR) NOT NULL,
+ LABEL_KEY VARCHAR2(100 CHAR) DEFAULT NULL,
+ ID_ACLSBJGRP VARCHAR2( 50 CHAR ) DEFAULT NULL,
+ CONSTRAINT %%PREFIX%%JACL2_SUBJECT_PK PRIMARY KEY (ID_ACLSBJ)
+);
+
+CREATE TABLE %%PREFIX%%JACL2_USER_GROUP (
+ LOGIN VARCHAR2(50 CHAR) NOT NULL,
+ ID_ACLGRP VARCHAR2(50 CHAR) NOT NULL,
+ CONSTRAINT %%PREFIX%%JACL2_USER_GROUP_PK PRIMARY KEY (LOGIN, ID_ACLGRP)
+);
+
+
+CREATE TABLE %%PREFIX%%JACL2_SUBJECT_GROUP (
+ ID_ACLSBJGRP VARCHAR2( 50 CHAR ) NOT NULL ,
+ LABEL_KEY VARCHAR2( 60 CHAR ) NOT NULL ,
+ CONSTRAINT %%PREFIX%%JACL2_SUBJECT_GROUP_PK PRIMARY KEY (ID_ACLSBJGRP)
+);
+
+
+ALTER TABLE %%PREFIX%%JACL2_RIGHTS
+ ADD CONSTRAINT %%PREFIX%%JACL2_RIGHTS_FK_1 FOREIGN KEY (ID_ACLGRP) REFERENCES %%PREFIX%%JACL2_GROUP(ID_ACLGRP);
+
+ALTER TABLE %%PREFIX%%JACL2_RIGHTS
+ ADD CONSTRAINT %%PREFIX%%JACL2_RIGHTS_FK_2 FOREIGN KEY (ID_ACLSBJ) REFERENCES %%PREFIX%%JACL2_SUBJECT(ID_ACLSBJ);
+
+ALTER TABLE %%PREFIX%%JACL2_USER_GROUP
+ ADD CONSTRAINT %%PREFIX%%JACL2_USER_GROUP_FK FOREIGN KEY (ID_ACLGRP) REFERENCES %%PREFIX%%JACL2_GROUP(ID_ACLGRP);
+
+ALTER TABLE %%PREFIX%%JACL2_SUBJECT
+ ADD CONSTRAINT %%PREFIX%%JACL2_SUBJECT_FK FOREIGN KEY (ID_ACLSBJGRP) REFERENCES %%PREFIX%%JACL2_SUBJECT_GROUP(ID_ACLSBJGRP);
View
8 lib/jelix-modules/jauthdb/install/install_jauth.schema.oci.sql
@@ -0,0 +1,8 @@
+CREATE TABLE %%PREFIX%%JLX_USER (
+ USR_LOGIN VARCHAR2(50 CHAR) NOT NULL,
+ USR_PASSWORD VARCHAR2(50 CHAR) NOT NULL,
+ USR_EMAIL VARCHAR2(255 CHAR) DEFAULT NULL
+);
+
+ALTER TABLE ONLY %%PREFIX%%JLX_USER
+ ADD CONSTRAINT JLX_USER_PKEY PRIMARY KEY (USR_LOGIN);
Something went wrong with that request. Please try again.