Hello,

please consider the attached patch which creates new global
rhnConfiguration table (to avoid adding more confiugration options
to /etc/rhn/rhn.conf) to be able to define which organization
externally-authenticated users should be created in.

-- 
Jan Pazdziora
Principal Software Engineer, Identity Management Engineering, Red Hat
>From cd652fd1045aa2c4f3e5a4219a7bff4421ff7083 Mon Sep 17 00:00:00 2001
From: Jan Pazdziora <jpazdzi...@redhat.com>
Date: Mon, 13 Jan 2014 17:29:45 +0800
Subject: [PATCH] New global configuration table, to store default organization
 for externally authenticated users.

---
 schema/spacewalk/common/rhnConfiguration.sql       | 35 ++++++++++++++++++++++
 .../spacewalk/oracle/triggers/rhnConfiguration.sql | 24 +++++++++++++++
 .../postgres/triggers/rhnConfiguration.sql         | 29 ++++++++++++++++++
 .../040-rhnConfiguration.sql                       | 35 ++++++++++++++++++++++
 .../041-rhnConfiguration-trigger.sql.oracle        | 24 +++++++++++++++
 .../041-rhnConfiguration-trigger.sql.postgresql    | 29 ++++++++++++++++++
 6 files changed, 176 insertions(+)
 create mode 100644 schema/spacewalk/common/rhnConfiguration.sql
 create mode 100644 schema/spacewalk/oracle/triggers/rhnConfiguration.sql
 create mode 100644 schema/spacewalk/postgres/triggers/rhnConfiguration.sql
 create mode 100644 
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/040-rhnConfiguration.sql
 create mode 100644 
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/041-rhnConfiguration-trigger.sql.oracle
 create mode 100644 
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/041-rhnConfiguration-trigger.sql.postgresql

diff --git a/schema/spacewalk/common/rhnConfiguration.sql 
b/schema/spacewalk/common/rhnConfiguration.sql
new file mode 100644
index 0000000..0b1731f
--- /dev/null
+++ b/schema/spacewalk/common/rhnConfiguration.sql
@@ -0,0 +1,35 @@
+--
+-- Copyright (c) 2014 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+
+create table rhnOrgConfiguration
+(
+    id                     number not null
+                                   default (42) not null
+                                   check(id = 42),
+    default_ext_customer_id number
+                                   constraint rhn_conf_default_org_id_fk
+                                   references web_customer(id)
+                                   on delete cascade,
+    created                    timestamp with local time zone
+                                   default (current_timestamp) not null,
+    modified                   timestamp with local time zone
+                                   default (current_timestamp) not null
+)
+enable row movement
+;
+
+create unique index rhn_conf_id
+    on rhnConfiguration (id)
+    tablespace [[8m_tbs]];
diff --git a/schema/spacewalk/oracle/triggers/rhnConfiguration.sql 
b/schema/spacewalk/oracle/triggers/rhnConfiguration.sql
new file mode 100644
index 0000000..538c6d1
--- /dev/null
+++ b/schema/spacewalk/oracle/triggers/rhnConfiguration.sql
@@ -0,0 +1,24 @@
+--
+-- Copyright (c) 2014 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+
+create or replace trigger
+rhn_conf_mod_trig
+before insert or update on rhnConfiguration
+for each row
+begin
+        :new.modified := current_timestamp;
+end;
+/
+show errors
diff --git a/schema/spacewalk/postgres/triggers/rhnConfiguration.sql 
b/schema/spacewalk/postgres/triggers/rhnConfiguration.sql
new file mode 100644
index 0000000..b7c6b91
--- /dev/null
+++ b/schema/spacewalk/postgres/triggers/rhnConfiguration.sql
@@ -0,0 +1,29 @@
+-- oracle equivalent source sha1 ebf4903b278ce8c8315da67743451186fb9b8b7a
+--
+-- Copyright (c) 2014 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+
+create or replace function rhn_conf_mod_trig_fun() returns trigger as
+$$
+begin
+        new.modified := current_timestamp;
+        return new;
+end;
+$$ language plpgsql;
+
+create trigger
+rhn_conf_mod_trig
+before insert or update on rhnConfiguration
+for each row
+execute procedure rhn_conf_mod_trig_fun();
diff --git 
a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/040-rhnConfiguration.sql
 
b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/040-rhnConfiguration.sql
new file mode 100644
index 0000000..0b1731f
--- /dev/null
+++ 
b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/040-rhnConfiguration.sql
@@ -0,0 +1,35 @@
+--
+-- Copyright (c) 2014 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+
+create table rhnOrgConfiguration
+(
+    id                     number not null
+                                   default (42) not null
+                                   check(id = 42),
+    default_ext_customer_id number
+                                   constraint rhn_conf_default_org_id_fk
+                                   references web_customer(id)
+                                   on delete cascade,
+    created                    timestamp with local time zone
+                                   default (current_timestamp) not null,
+    modified                   timestamp with local time zone
+                                   default (current_timestamp) not null
+)
+enable row movement
+;
+
+create unique index rhn_conf_id
+    on rhnConfiguration (id)
+    tablespace [[8m_tbs]];
diff --git 
a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/041-rhnConfiguration-trigger.sql.oracle
 
b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/041-rhnConfiguration-trigger.sql.oracle
new file mode 100644
index 0000000..538c6d1
--- /dev/null
+++ 
b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/041-rhnConfiguration-trigger.sql.oracle
@@ -0,0 +1,24 @@
+--
+-- Copyright (c) 2014 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+
+create or replace trigger
+rhn_conf_mod_trig
+before insert or update on rhnConfiguration
+for each row
+begin
+        :new.modified := current_timestamp;
+end;
+/
+show errors
diff --git 
a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/041-rhnConfiguration-trigger.sql.postgresql
 
b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/041-rhnConfiguration-trigger.sql.postgresql
new file mode 100644
index 0000000..b7c6b91
--- /dev/null
+++ 
b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/041-rhnConfiguration-trigger.sql.postgresql
@@ -0,0 +1,29 @@
+-- oracle equivalent source sha1 ebf4903b278ce8c8315da67743451186fb9b8b7a
+--
+-- Copyright (c) 2014 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+
+create or replace function rhn_conf_mod_trig_fun() returns trigger as
+$$
+begin
+        new.modified := current_timestamp;
+        return new;
+end;
+$$ language plpgsql;
+
+create trigger
+rhn_conf_mod_trig
+before insert or update on rhnConfiguration
+for each row
+execute procedure rhn_conf_mod_trig_fun();
-- 
1.8.3.1

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to