backend/server/importlib/userAuth.py
| 18
backend/server/rhnUser.py
| 17
java/code/src/com/redhat/rhn/domain/org/OrgFactory.java
| 1
java/code/src/com/redhat/rhn/domain/org/test/OrgFactoryTest.java
| 5
java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
| 21
java/code/src/com/redhat/rhn/frontend/action/user/UserEditSetupAction.java
| 9
java/code/src/com/redhat/rhn/frontend/action/user/test/UserEditActionTest.java
| 2
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_bn_IN.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_de.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_es.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_fr.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_gu.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_hi.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_it.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ja.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ko.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_pa.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_pt_BR.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ru.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ta.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_zh_CN.xml
| 6
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_zh_TW.xml
| 6
java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
| 11
java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
| 7
java/code/src/com/redhat/rhn/manager/channel/test/CreateCommandTest.java
| 3
schema/spacewalk/common/data/rhnUserGroupType.sql
| 24
schema/spacewalk/oracle/packages/rhn_entitlements.pkb
| 3
schema/spacewalk/oracle/procs/create_first_org.sql
| 17
schema/spacewalk/oracle/procs/create_new_org.sql
| 17
schema/spacewalk/oracle/procs/is_user_applicant.sql
| 57
schema/spacewalk/oracle/procs/procs.deps
| 2
schema/spacewalk/oracle/triggers/rhnUserGroupMembers.sql
| 27
schema/spacewalk/postgres/packages/rhn_entitlements.pkb
| 4
schema/spacewalk/postgres/procs/create_first_org.sql
| 19
schema/spacewalk/postgres/procs/create_new_org.sql
| 19
schema/spacewalk/postgres/procs/is_user_applicant.sql
| 53
schema/spacewalk/postgres/procs/procs.deps
| 2
schema/spacewalk/postgres/triggers/rhnUserGroupMembers.sql
| 40
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/114-rhnUserGroupType_rhn_superuser.sql
| 5
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/115-rhnUserGroupType_rhn_support.sql
| 5
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/116-rhnUserGroupType_cert_admin.sql
| 5
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/117-is_user_applicant.sql
| 1
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/118-create_first_org.sql.oracle
| 137
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/118-create_first_org.sql.postgresql
| 138
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/119-create_new_org.sql.oracle
| 123
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/119-create_new_org.sql.postgresql
| 128
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/120-rhn_entitlements.pkb.oracle
| 1770 ++++++++++
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/120-rhn_entitlements.pkb.postgresql
| 132
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/121-rhnUserGroupMembers-trigger.sql.oracle
| 1
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/121-rhnUserGroupMembers-trigger.sql.postgresql
| 6
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/122-rhnUserGroupType_org_applicant.sql
| 5
web/modules/rhn/RHN/Cleansers.pm
| 1
web/modules/rhn/RHN/DB/User.pm
| 18
web/modules/sniglets/Sniglets/ChannelEditor.pm
| 16
web/modules/sniglets/Sniglets/Users.pm
| 7
56 files changed, 2473 insertions(+), 499 deletions(-)
New commits:
commit b5a9ccda2feb2b182b9f9782dbf0df8abb260d5f
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 17:30:29 2012 +0200
remove org_applicant from rhnUserGroupType table
diff --git a/schema/spacewalk/common/data/rhnUserGroupType.sql
b/schema/spacewalk/common/data/rhnUserGroupType.sql
index 6992327..be981d7 100644
--- a/schema/spacewalk/common/data/rhnUserGroupType.sql
+++ b/schema/spacewalk/common/data/rhnUserGroupType.sql
@@ -31,12 +31,6 @@ insert into rhnUserGroupType (id, label, name) values (
insert into rhnUserGroupType (id, label, name) values (
sequence_nextval('rhn_usergroup_type_seq'),
- 'org_applicant',
- 'Organization Applicant'
-);
-
-insert into rhnUserGroupType (id, label, name) values (
- sequence_nextval('rhn_usergroup_type_seq'),
'channel_admin',
'Channel Administrator'
);
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/122-rhnUserGroupType_org_applicant.sql
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/122-rhnUserGroupType_org_applicant.sql
new file mode 100644
index 0000000..e471dea
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/122-rhnUserGroupType_org_applicant.sql
@@ -0,0 +1,5 @@
+DELETE FROM rhnUserGroupMembers WHERE user_group_id IN (SELECT g.id from rhnUserGroup g
JOIN rhnUserGroupType gt ON g.group_type = gt.id WHERE gt.label =
'org_applicant');
+
+DELETE FROM rhnUserGroup WHERE group_type IN (SELECT id FROM rhnUserGroupType WHERE label
= 'org_applicant');
+
+DELETE FROM rhnUserGroupType WHERE label = 'org_applicant';
commit f9ffc8a86b5273a67ec474ed677af4800dac5045
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 17:15:53 2012 +0200
remove usage of org_applicant user role
diff --git a/backend/server/rhnUser.py b/backend/server/rhnUser.py
index c946201..d347f91 100644
--- a/backend/server/rhnUser.py
+++ b/backend/server/rhnUser.py
@@ -221,21 +221,8 @@ class User:
def __save(self):
""" Save this record in the database. """
is_admin = 0
- if self.customer.real:
- # get the org_id and the applicant group id for this org
- org_id = self.customer["id"]
- h = rhnSQL.prepare("""
- select ug.id
- from rhnUserGroup ug, rhnUserGroupType ugt
- where ugt.label = 'org_applicant'
- and ug.group_type = ugt.id
- and ug.org_id = :org_id
- """)
- h.execute(org_id=org_id)
- data = h.fetchone_dict()
- # XXX: prone to errors, but we'll need to see them first
- grp_id = data["id"]
- else: # an org does not exist... create one
+ if not self.customer.real:
+ # an org does not exist... create one
create_new_org = rhnSQL.Procedure("create_new_org")
ret = create_new_org(
self.customer["name"],
diff --git a/web/modules/sniglets/Sniglets/Users.pm
b/web/modules/sniglets/Sniglets/Users.pm
index 7b4400c..ecb8e0f 100644
--- a/web/modules/sniglets/Sniglets/Users.pm
+++ b/web/modules/sniglets/Sniglets/Users.pm
@@ -202,11 +202,6 @@ sub forgot_password_cb {
my $password = PXT::Utils->random_password(12);
my $username = $user->login;
- if ($user->is('org_applicant')) {
- $pxt->push_message(local_alert => 'Your account has not yet been
approved. When it is, you will be notified via email.');
- return;
- }
-
$user->set_password($password);
$user->commit;
@@ -359,7 +354,7 @@ sub check_perms {
}
#role - property of a user - currently channel_admin, coma_admin,
- #coma_author, coma_publisher, org_admin, org_applicant.
+ #coma_author, coma_publisher, org_admin.
if ($params{role}) {
if ($params{role} =~ /^!(.*)$/) {
return if $pxt->user->is($1);
commit 0e856eaeeb0a4f972001f0b6599c439dae221e31
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 16:27:03 2012 +0200
remove org_applicant related triggers
diff --git a/schema/spacewalk/oracle/triggers/rhnUserGroupMembers.sql
b/schema/spacewalk/oracle/triggers/rhnUserGroupMembers.sql
index 1b8e09c..605e74e 100644
--- a/schema/spacewalk/oracle/triggers/rhnUserGroupMembers.sql
+++ b/schema/spacewalk/oracle/triggers/rhnUserGroupMembers.sql
@@ -83,33 +83,6 @@ end;
/
show errors
-create or replace trigger
-rhn_ugm_applicant_fix
-after delete on rhnUserGroupMembers
-for each row
-declare
- group_type_val NUMBER;
- group_label_val rhnUserGroupType.label%TYPE;
-begin
- SELECT group_type INTO group_type_val
- FROM rhnUserGroup
- WHERE id = :old.user_group_id;
-
- IF group_type_val IS NOT NULL
- THEN
- SELECT label INTO group_label_val
- FROM rhnUserGroupType
- WHERE id = group_type_val;
-
- IF group_label_val = 'org_applicant'
- THEN
- UPDATE web_contact SET password = old_password WHERE id = :old.user_id;
- END IF;
- END IF;
-end;
-/
-show errors
-
--
-- Revision 1.6 2002/05/10 22:00:48 pjones
-- add rhnFAQClass, and make it a dep for rhnFAQ
diff --git a/schema/spacewalk/postgres/triggers/rhnUserGroupMembers.sql
b/schema/spacewalk/postgres/triggers/rhnUserGroupMembers.sql
index a9ef603..fb6661a 100644
--- a/schema/spacewalk/postgres/triggers/rhnUserGroupMembers.sql
+++ b/schema/spacewalk/postgres/triggers/rhnUserGroupMembers.sql
@@ -1,4 +1,4 @@
--- oracle equivalent source sha1 0e562b1725e73cb9739287fbb46eab11df7646ee
+-- oracle equivalent source sha1 c1d797e0a54dc1fb3b13fe3ba5f262da37f64afc
-- retrieved from
./1241132947/9984c41fb98d15becf3c29432c19cd7a266dece4/schema/spacewalk/oracle/triggers/rhnUserGroupMembers.sql
--
-- Copyright (c) 2008--2011 Red Hat, Inc.
@@ -109,41 +109,3 @@ before delete on rhnUserGroupMembers
for each row
execute procedure rhn_ug_member_del_trig_fun();
-
-
-
-create or replace function rhn_ugm_applicant_fix_fun() returns trigger
-as
-$$
-declare
- group_type_val NUMERIC;
- group_label_val rhnUserGroupType.label%TYPE;
-begin
- SELECT group_type INTO group_type_val
- FROM rhnUserGroup
- WHERE id = old.user_group_id;
-
- IF group_type_val IS NOT NULL
- THEN
- SELECT label INTO group_label_val
- FROM rhnUserGroupType
- WHERE id = group_type_val;
-
- IF group_label_val = 'org_applicant'
- THEN
- UPDATE web_contact SET password = old_password WHERE id = old.user_id;
- END IF;
- END IF;
- return new;
-end;
-$$ LANGUAGE PLPGSQL;
-
-
-create trigger
-rhn_ugm_applicant_fix
-after delete on rhnUserGroupMembers
-for each row
-execute procedure rhn_ugm_applicant_fix_fun();
-
-
-
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/121-rhnUserGroupMembers-trigger.sql.oracle
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/121-rhnUserGroupMembers-trigger.sql.oracle
new file mode 100644
index 0000000..e946407
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/121-rhnUserGroupMembers-trigger.sql.oracle
@@ -0,0 +1 @@
+DROP TRIGGER rhn_ugm_applicant_fix;
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/121-rhnUserGroupMembers-trigger.sql.postgresql
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/121-rhnUserGroupMembers-trigger.sql.postgresql
new file mode 100644
index 0000000..d703d53
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/121-rhnUserGroupMembers-trigger.sql.postgresql
@@ -0,0 +1,6 @@
+-- oracle equivalent source sha1 d427b385438e23da935905dc96c9aae3e641736f
+--
+
+DROP TRIGGER rhn_ugm_applicant_fix;
+
+DROP FUNCTION rhn_ugm_applicant_fix_fun;
commit 64605dd11a70801666412528087bc8aa3d18b02b
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 16:06:57 2012 +0200
remove org_applicant from rhn_entitlements
diff --git a/schema/spacewalk/oracle/packages/rhn_entitlements.pkb
b/schema/spacewalk/oracle/packages/rhn_entitlements.pkb
index 1d1333c..6594837 100644
--- a/schema/spacewalk/oracle/packages/rhn_entitlements.pkb
+++ b/schema/spacewalk/oracle/packages/rhn_entitlements.pkb
@@ -827,9 +827,6 @@ is
roles_to_process.extend;
roles_to_process(roles_to_process.count) := 'activation_key_admin';
-
- roles_to_process.extend;
- roles_to_process(roles_to_process.count) := 'org_applicant';
elsif service_label_in = 'provisioning' then
ents_to_process.extend;
ents_to_process(ents_to_process.count) := 'rhn_provisioning';
diff --git a/schema/spacewalk/postgres/packages/rhn_entitlements.pkb
b/schema/spacewalk/postgres/packages/rhn_entitlements.pkb
index 2ed168a..c335ec9 100644
--- a/schema/spacewalk/postgres/packages/rhn_entitlements.pkb
+++ b/schema/spacewalk/postgres/packages/rhn_entitlements.pkb
@@ -1,4 +1,4 @@
--- oracle equivalent source sha1 3c08ae96ed82d9b7339d494306c73052ebe2938e
+-- oracle equivalent source sha1 3fe11cae9cdf4c4add57938bef09be71fa1f52c4
--
-- Copyright (c) 2008--2012 Red Hat, Inc.
--
@@ -834,8 +834,6 @@ as $$
roles_to_process := array_append(roles_to_process,
'system_group_admin');
roles_to_process := array_append(roles_to_process,
'activation_key_admin');
-
- roles_to_process := array_append(roles_to_process, 'org_applicant');
elsif service_label_in = 'provisioning' then
ents_to_process := array_append(ents_to_process,
'rhn_provisioning');
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/120-rhn_entitlements.pkb.oracle
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/120-rhn_entitlements.pkb.oracle
new file mode 100644
index 0000000..089addf
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/120-rhn_entitlements.pkb.oracle
@@ -0,0 +1,1770 @@
+
+create or replace
+package body rhn_entitlements
+is
+ body_version varchar2(100) := '';
+
+ function find_compatible_sg (
+ server_id_in in number,
+ type_label_in in varchar2
+ ) return number is
+
+ cursor servergroups is
+ select sg.id id
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg,
+ rhnServer s,
+ rhnServerServerGroupArchCompat ssgac
+ where s.id = server_id_in
+ and s.org_id = sg.org_id
+ and sgt.label = type_label_in
+ and sg.group_type = sgt.id
+ and ssgac.server_group_type = sgt.id
+ and ssgac.server_arch_id = s.server_arch_id
+ and not exists (
+ select 1
+ from rhnServerGroupMembers sgm
+ where sgm.server_group_id = sg.id
+ and sgm.server_id = s.id);
+
+
+ begin
+ for servergroup in servergroups loop
+ return servergroup.id;
+ end loop;
+
+ --no servergroup found
+ return null;
+ end find_compatible_sg;
+
+
+ -- *******************************************************************
+ -- PROCEDURE: remove_org_entitlements
+ --
+ -- Removes both system entitlements and channel subscriptions
+ -- that are currently assigned to an org and re-assigns to the
+ -- master org (org_id = 1).
+ --
+ -- When we call this we expect everything to already be unentitled
+ -- which shoul be handled by delete_org.
+ --
+ -- Called by: delete_org
+ -- *******************************************************************
+ procedure remove_org_entitlements(
+ org_id_in in number
+ )
+ is
+
+ cursor system_ents is
+ select sg.id, sg.max_members, sg.group_type
+ from rhnServerGroup sg
+ where group_type is not null
+ and org_id = org_id_in;
+
+ cursor channel_subs is
+ select pcf.channel_family_id, pcf.max_members
+ from rhnChannelFamily cf,
+ rhnPrivateChannelFamily pcf
+ where pcf.org_id = org_id_in
+ and pcf.channel_family_id = cf.id
+ and cf.org_id is null;
+
+ begin
+
+ for system_ent in system_ents loop
+ update rhnServerGroup
+ set max_members = max_members + system_ent.max_members
+ where org_id = 1
+ and group_type = system_ent.group_type;
+ end loop;
+
+ update rhnServerGroup
+ set max_members = 0
+ where org_id = org_id_in;
+
+ for channel_sub in channel_subs loop
+ update rhnPrivateChannelFamily
+ set max_members = max_members + channel_sub.max_members
+ where org_id = 1
+ and channel_family_id = channel_sub.channel_family_id;
+ end loop;
+
+ update rhnPrivateChannelFamily
+ set max_members = 0
+ where org_id = org_id_in;
+
+ end remove_org_entitlements;
+
+ function entitlement_grants_service (
+ entitlement_in in varchar2,
+ service_level_in in varchar2
+ ) return number is
+ begin
+ if service_level_in = 'provisioning' then
+ if entitlement_in = 'provisioning_entitled' then
+ return 1;
+ else
+ return 0;
+ end if;
+ elsif service_level_in = 'management' then
+ if entitlement_in = 'enterprise_entitled' then
+ return 1;
+ else
+ return 0;
+ end if;
+ elsif service_level_in = 'monitoring' then
+ if entitlement_in = 'monitoring_entitled' then
+ return 1;
+ end if;
+ elsif service_level_in = 'updates' then
+ return 1;
+ else
+ return 0;
+ end if;
+ end entitlement_grants_service;
+
+ function lookup_entitlement_group (
+ org_id_in in number,
+ type_label_in in varchar2 := 'sw_mgr_entitled'
+ ) return number is
+ cursor server_groups is
+ select sg.id server_group_id
+ from rhnServerGroup sg,
+ rhnServerGroupType sgt
+ where sgt.label = type_label_in
+ and sgt.id = sg.group_type
+ and sg.org_id = org_id_in;
+ begin
+ for sg in server_groups loop
+ return sg.server_group_id;
+ end loop;
+ return rhn_entitlements.create_entitlement_group(
+ org_id_in,
+ type_label_in
+ );
+ end lookup_entitlement_group;
+
+ function create_entitlement_group (
+ org_id_in in number,
+ type_label_in in varchar2 := 'sw_mgr_entitled'
+ ) return number is
+ sg_id_val number;
+ begin
+ select rhn_server_group_id_seq.nextval
+ into sg_id_val
+ from dual;
+
+ insert into rhnServerGroup (
+ id, name, description, max_members, current_members,
+ group_type, org_id
+ ) (
+ select sg_id_val, sgt.label, sgt.label,
+ 0, 0, sgt.id, org_id_in
+ from rhnServerGroupType sgt
+ where sgt.label = type_label_in
+ );
+
+ return sg_id_val;
+ end create_entitlement_group;
+
+ function can_entitle_server (
+ server_id_in in number,
+ type_label_in in varchar2 )
+ return number is
+ cursor addon_servergroups (base_label_in in varchar2,
+ addon_label_in in varchar2) is
+ select
+ addon_id
+ from
+ rhnSGTypeBaseAddonCompat
+ where base_id = lookup_sg_type (base_label_in)
+ and addon_id = lookup_sg_type (addon_label_in);
+
+ previous_ent rhn_entitlements.ents_array;
+ is_base_in char := 'N';
+ is_base_current char := 'N';
+ i number := 0;
+ sgid number := 0;
+
+ begin
+
+ previous_ent := rhn_entitlements.ents_array();
+ previous_ent := rhn_entitlements.get_server_entitlement(server_id_in);
+
+ select distinct is_base
+ into is_base_in
+ from rhnServerGroupType
+ where label = type_label_in;
+
+ if previous_ent.count = 0 then
+ sgid := find_compatible_sg (server_id_in, type_label_in);
+ if (is_base_in = 'Y' and sgid is not null) then
+ -- rhn_server.insert_into_servergroup (server_id_in, sgid);
+ return 1;
+ else
+ -- rhn_exception.raise_exception ('invalid_base_entitlement');
+ return 0;
+ end if;
+
+ -- there are previous ents, first make sure we're not trying to entitle a base
ent
+ elsif is_base_in = 'Y' then
+ -- rhn_exception.raise_exception ('invalid_addon_entitlement');
+ return 0;
+
+ -- it must be an addon, so proceed with the entitlement
+ else
+
+ -- find the servers base ent
+ is_base_current := 'N';
+ i := 0;
+ while is_base_current = 'N' and i <= previous_ent.count
+ loop
+ i := i + 1;
+ select is_base
+ into is_base_current
+ from rhnServerGroupType
+ where label = previous_ent(i);
+ end loop;
+
+ -- never found a base ent, that would be strange
+ if is_base_current = 'N' then
+ -- rhn_exception.raise_exception ('invalid_base_entitlement');
+ return 0;
+ end if;
+
+ -- this for loop verifies the validity of the addon path
+ for addon_servergroup in addon_servergroups (previous_ent(i), type_label_in)
loop
+ -- find an appropriate sgid for the addon and entitle the server
+ sgid := find_compatible_sg (server_id_in, type_label_in);
+ if sgid is not null then
+ -- rhn_server.insert_into_servergroup (server_id_in, sgid);
+ return 1;
+ else
+ -- rhn_exception.raise_exception ('invalid_addon_entitlement');
+ return 0;
+ end if;
+ end loop;
+
+ end if;
+
+ return 0;
+
+ end can_entitle_server;
+
+ function can_switch_base (
+ server_id_in in integer,
+ type_label_in in varchar2
+ ) return number is
+
+ type_label_in_is_base char(1);
+ sgid number;
+
+ begin
+
+ begin
+ select is_base into type_label_in_is_base
+ from rhnServerGroupType
+ where label = type_label_in;
+ exception
+ when no_data_found then
+ rhn_exception.raise_exception ( 'invalid_entitlement' );
+ end;
+
+ if type_label_in_is_base = 'N' then
+ rhn_exception.raise_exception ( 'invalid_entitlement' );
+ else
+ sgid := find_compatible_sg ( server_id_in, type_label_in );
+ if sgid is not null then
+ return 1;
+ else
+ return 0;
+ end if;
+ end if;
+
+ end can_switch_base;
+
+
+ procedure entitle_server (
+ server_id_in in number,
+ type_label_in in varchar2 := 'sw_mgr_entitled'
+ ) is
+ sgid number := 0;
+ is_virt number := 0;
+
+ begin
+
+ begin
+ select 1 into is_virt
+ from rhnServerEntitlementView
+ where server_id = server_id_in
+ and label in ('virtualization_host',
'virtualization_host_platform');
+ exception
+ when no_data_found then
+ is_virt := 0;
+ end;
+
+ if is_virt = 0 and (type_label_in = 'virtualization_host' or
+ type_label_in = 'virtualization_host_platform') then
+
+ is_virt := 1;
+ end if;
+
+
+
+ if rhn_entitlements.can_entitle_server(server_id_in,
+ type_label_in) = 1 then
+ sgid := find_compatible_sg (server_id_in, type_label_in);
+ if sgid is not null then
+ insert into rhnServerHistory ( id, server_id, summary, details )
+ values ( rhn_event_id_seq.nextval, server_id_in,
+ 'added system entitlement ',
+ case type_label_in
+ when 'enterprise_entitled' then 'Management'
+ when 'sw_mgr_entitled' then 'Update'
+ when 'provisioning_entitled' then 'Provisioning'
+ when 'monitoring_entitled' then 'Monitoring'
+ when 'virtualization_host' then 'Virtualization'
+ when 'virtualization_host_platform' then
+ 'Virtualization Platform' end );
+
+ rhn_server.insert_into_servergroup (server_id_in, sgid);
+
+ if is_virt = 1 then
+ rhn_entitlements.repoll_virt_guest_entitlements(server_id_in);
+ end if;
+
+ else
+ rhn_exception.raise_exception ('no_available_server_group');
+ end if;
+ else
+ rhn_exception.raise_exception ('invalid_entitlement');
+ end if;
+ end entitle_server;
+
+ procedure remove_server_entitlement (
+ server_id_in in number,
+ type_label_in in varchar2 := 'sw_mgr_entitled',
+ repoll_virt_guests in number := 1
+ ) is
+ group_id number;
+ type_is_base char;
+ is_virt number := 0;
+ begin
+ begin
+
+
+ -- would be nice if there were a virt attribute of entitlement types, not have to
specify 2 different ones...
+ begin
+ select 1 into is_virt
+ from rhnServerEntitlementView
+ where server_id = server_id_in
+ and label in ('virtualization_host',
'virtualization_host_platform');
+ exception
+ when no_data_found then
+ is_virt := 0;
+ end;
+
+ select sg.id, sgt.is_base
+ into group_id, type_is_base
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg,
+ rhnServerGroupMembers sgm,
+ rhnServer s
+ where s.id = server_id_in
+ and s.id = sgm.server_id
+ and sgm.server_group_id = sg.id
+ and sg.org_id = s.org_id
+ and sgt.label = type_label_in
+ and sgt.id = sg.group_type;
+
+ if ( type_is_base = 'Y' ) then
+ -- unentitle_server should handle everything, don't really need to do
anything else special here
+ unentitle_server ( server_id_in );
+ else
+
+ insert into rhnServerHistory ( id, server_id, summary, details )
+ values ( rhn_event_id_seq.nextval, server_id_in,
+ 'removed system entitlement ',
+ case type_label_in
+ when 'enterprise_entitled' then 'Management'
+ when 'sw_mgr_entitled' then 'Update'
+ when 'provisioning_entitled' then 'Provisioning'
+ when 'monitoring_entitled' then 'Monitoring'
+ when 'virtualization_host' then 'Virtualization'
+ when 'virtualization_host_platform' then
+ 'Virtualization Platforrm' end );
+
+ rhn_server.delete_from_servergroup(server_id_in, group_id);
+
+ if type_label_in = 'monitoring_entitled' then
+ DELETE
+ FROM rhn_probe
+ WHERE recid IN (SELECT probe_id
+ FROM rhn_check_probe
+ WHERE host_id = server_id_in);
+ end if;
+
+ if is_virt = 1 and repoll_virt_guests = 1 then
+ rhn_entitlements.repoll_virt_guest_entitlements(server_id_in);
+ end if;
+ end if;
+
+ exception
+ when no_data_found then
+ rhn_exception.raise_exception('invalid_server_group_member');
+ end;
+
+ end remove_server_entitlement;
+
+
+ procedure unentitle_server (server_id_in in number) is
+
+ cursor servergroups is
+ select distinct sgt.label, sg.id server_group_id
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg,
+ rhnServer s,
+ rhnServerGroupMembers sgm
+ where s.id = server_id_in
+ and s.org_id = sg.org_id
+ and sg.group_type = sgt.id
+ and sgm.server_group_id = sg.id
+ and sgm.server_id = s.id;
+
+ is_virt number := 0;
+
+ begin
+
+ begin
+ select 1 into is_virt
+ from rhnServerEntitlementView
+ where server_id = server_id_in
+ and label in ('virtualization_host',
'virtualization_host_platform');
+ exception
+ when no_data_found then
+ is_virt := 0;
+ end;
+
+ for servergroup in servergroups loop
+
+ insert into rhnServerHistory ( id, server_id, summary, details )
+ values ( rhn_event_id_seq.nextval, server_id_in,
+ 'removed system entitlement ',
+ case servergroup.label
+ when 'enterprise_entitled' then 'Management'
+ when 'sw_mgr_entitled' then 'Update'
+ when 'provisioning_entitled' then 'Provisioning'
+ when 'monitoring_entitled' then 'Monitoring'
+ when 'virtualization_host' then 'Virtualization'
+ when 'virtualization_host_platform' then
+ 'Virtualization Platform' end );
+
+ rhn_server.delete_from_servergroup(server_id_in,
+ servergroup.server_group_id );
+ end loop;
+
+ if is_virt = 1 then
+ rhn_entitlements.repoll_virt_guest_entitlements(server_id_in);
+ end if;
+
+ end unentitle_server;
+
+
+ -- *******************************************************************
+ -- PROCEDURE: repoll_virt_guest_entitlements
+ --
+ -- Whenever we add/remove a virtualization_host* entitlement from
+ -- a host, we can call this procedure to update what type of slots
+ -- the guests are consuming.
+ --
+ -- If you're removing the entitlement, it's
+ -- possible the guests will become unentitled if you don't have enough
+ -- physical slots to cover them.
+ --
+ -- If you're adding the entitlement, you end up freeing up physical
+ -- slots for other systems.
+ --
+ -- *******************************************************************
+ procedure repoll_virt_guest_entitlements(server_id_in in number)
+ is
+
+ -- All channel families associated with the guests of server_id_in
+ cursor families is
+ select distinct cfs.channel_family_id
+ from
+ rhnChannelFamilyServers cfs,
+ rhnVirtualInstance vi
+ where
+ vi.host_system_id = server_id_in
+ and vi.virtual_system_id = cfs.server_id;
+
+ -- All of server group types associated with the guests of
+ -- server_id_in
+ cursor group_types is
+ select distinct sg.group_type, sgt.label
+ from
+ rhnServerGroupType sgt,
+ rhnServerGroup sg,
+ rhnServerGroupMembers sgm,
+ rhnVirtualInstance vi
+ where
+ vi.host_system_id = server_id_in
+ and vi.virtual_system_id = sgm.server_id
+ and sgm.server_group_id = sg.id
+ and sg.group_type = sgt.id;
+
+ -- Virtual servers from a certain family belonging to a speicifc
+ -- host that are consuming physical channel slots over the limit.
+ cursor virt_servers_cfam(family_id_in in number, quantity_in in number) is
+ select virtual_system_id
+ from (
+ select rownum, vi.virtual_system_id
+ from
+ rhnChannelFamilyMembers cfm,
+ rhnServerChannel sc,
+ rhnVirtualInstance vi
+ where
+ vi.host_system_id = server_id_in
+ and vi.virtual_system_id = sc.server_id
+ and sc.channel_id = cfm.channel_id
+ and cfm.channel_family_id = family_id_in
+ order by sc.modified desc
+ )
+ where rownum <= quantity_in;
+
+ -- Virtual servers from a certain family belonging to a speicifc
+ -- host that are consuming physical system slots over the limit.
+ cursor virt_servers_sgt(group_type_in in number, quantity_in in number) is
+ select virtual_system_id
+ from (
+ select rownum, vi.virtual_system_id
+ from
+ rhnServerGroup sg,
+ rhnServerGroupMembers sgm,
+ rhnVirtualInstance vi
+ where
+ vi.host_system_id = server_id_in
+ and vi.virtual_system_id = sgm.server_id
+ and sgm.server_group_id = sg.id
+ and sg.group_type = group_type_in
+ order by sgm.modified desc
+ )
+ where rownum <= quantity_in;
+ -- Get the orgs of Virtual guests
+ -- Since they may belong to different orgs
+ cursor virt_guest_orgs is
+ select distinct (s.org_id)
+ from rhnServer s
+ inner join rhnVirtualInstance vi on vi.virtual_system_id = s.id
+ where
+ vi.host_system_id = server_id_in
+ and s.org_id <> (select s1.org_id from rhnServer s1 where s1.id
= vi.host_system_id) ;
+
+
+ org_id_val number;
+ max_members_val number;
+ max_flex_val number;
+ current_members_calc number;
+ sg_id number;
+ is_virt number := 0;
+ begin
+ begin
+ select 1 into is_virt
+ from rhnServerEntitlementView
+ where server_id = server_id_in
+ and label in ('virtualization_host',
'virtualization_host_platform');
+ exception
+ when no_data_found then
+ is_virt := 0;
+ end;
+
+ select org_id
+ into org_id_val
+ from rhnServer
+ where id = server_id_in;
+
+ -- deal w/ channel entitlements first ...
+ for family in families loop
+ if is_virt = 0 then
+ -- if the host_server does not have virt
+ --- find all possible flex slots
+ -- and set each of the flex eligible guests to Y
+ UPDATE rhnServerChannel sc set sc.is_fve = 'Y'
+ where sc.server_id in (
+ select virtual_system_id from (
+ select rownum, vi.virtual_system_id, sfc.max_members -
sfc.current_members as free_slots
+ from rhnServerFveCapable sfc
+ inner join rhnVirtualInstance vi on vi.virtual_system_id
= sfc.server_id
+ where vi.host_system_id = server_id_in
+ and sfc.channel_family_id = family.channel_family_id
+ order by vi.modified desc
+ )
+ where rownum <= free_slots
+ );
+ else
+ -- if the host_server has virt
+ -- set all its flex guests to N
+ UPDATE rhnServerChannel sc set sc.is_fve = 'N'
+ where
+ sc.channel_id in (select cfm.channel_id from rhnChannelFamilyMembers
cfm
+ where cfm.CHANNEL_FAMILY_ID =
family.channel_family_id)
+ and sc.is_fve = 'Y'
+ and sc.server_id in
+ (select vi.virtual_system_id from rhnVirtualInstance vi
+ where vi.host_system_id = server_id_in);
+ end if;
+
+ -- get the current (physical) members of the family
+ current_members_calc :=
+ rhn_channel.channel_family_current_members(family.channel_family_id,
+ org_id_val); -- fixed
transposed args
+
+ begin
+
+ -- get the max members of the family
+ select max_members
+ into max_members_val
+ from rhnPrivateChannelFamily
+ where channel_family_id = family.channel_family_id
+ and org_id = org_id_val;
+
+ select fve_max_members
+ into max_flex_val
+ from rhnPrivateChannelFamily
+ where channel_family_id = family.channel_family_id
+ and org_id = org_id_val;
+
+ if current_members_calc > max_members_val then
+ -- A virtualization_host* ent must have been removed, so we'll
+ -- unsubscribe guests from the host first.
+
+ -- hm, i don't think max_members - current_members_calc yielding a
negative number
+ -- will work w/ rownum, swaping 'em in the body of this if...
+ for virt_server in virt_servers_cfam(family.channel_family_id,
+ current_members_calc - max_members_val) loop
+
+ rhn_channel.unsubscribe_server_from_family(
+ virt_server.virtual_system_id,
+ family.channel_family_id);
+ end loop;
+
+ -- if we're still over the limit, which would be odd,
+ -- just prune the group to max_members
+ --
+ -- er... wouldn't we actually have to refresh the values of
+ -- current_members_calc and max_members_val to actually ever
+ -- *skip this??
+ if current_members_calc > max_members_val then
+ -- argh, transposed again?!
+ set_family_count(org_id_val,
+ family.channel_family_id,
+ max_members_val, max_flex_val);
+ --TODO calculate this correctly
+ end if;
+
+ end if;
+
+ -- update current_members for the family. This will set the value
+ -- to reflect adding/removing the entitlement.
+ --
+ -- what's the difference of doing this vs the unavoidable
set_family_count above?
+ rhn_channel.update_family_counts(family.channel_family_id,
+ org_id_val);
+
+ exception when no_data_found then null;
+ end;
+
+ -- It is possible that the guests belong to a different org than the host
+ -- so we are going to update the family counts in the guests orgs also
+ for org in virt_guest_orgs loop
+ rhn_channel.update_family_counts(family.channel_family_id,
+ org.org_id);
+ end loop;
+ end loop;
+
+ for a_group_type in group_types loop
+ -- get the current *physical* members of the system entitlement type for the
org...
+ --
+ -- unlike channel families, it appears the standard rhnServerGroup.max_members
represents
+ -- *physical* slots, vs physical+virt ... boy that's confusing...
+
+ select max_members, id
+ into max_members_val, sg_id
+ from rhnServerGroup
+ where group_type = a_group_type.group_type
+ and org_id = org_id_val;
+
+
+ select count(sep.server_id) into current_members_calc
+ from rhnServerEntitlementPhysical sep
+ where sep.server_group_id = sg_id
+ and sep.server_group_type_id = a_group_type.group_type;
+
+ if current_members_calc > max_members_val then
+ -- A virtualization_host* ent must have been removed, and we're over the
limit, so unsubscribe guests
+ for virt_server in virt_servers_sgt(a_group_type.group_type,
+ current_members_calc - max_members_val)
loop
+ rhn_entitlements.remove_server_entitlement(virt_server.virtual_system_id,
a_group_type.label);
+
+ -- decrement current_members_calc, we'll use it to reset
current_members for the group at the end...
+ current_members_calc := current_members_calc - 1;
+ end loop;
+
+ end if;
+
+ update rhnServerGroup set current_members = current_members_calc
+ where org_id = org_id_val
+ and group_type = a_group_type.group_type;
+
+ -- I think that's all the house-keeping we have to do...
+ end loop;
+
+ end repoll_virt_guest_entitlements;
+
+
+ function get_server_entitlement (
+ server_id_in in number
+ ) return ents_array is
+
+ cursor server_groups is
+ select sgt.label
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg,
+ rhnServerGroupMembers sgm
+ where 1=1
+ and sgm.server_id = server_id_in
+ and sg.id = sgm.server_group_id
+ and sgt.id = sg.group_type
+ and sgt.label in (
+ 'sw_mgr_entitled','enterprise_entitled',
+ 'provisioning_entitled', 'nonlinux_entitled',
+ 'monitoring_entitled', 'virtualization_host',
+ 'virtualization_host_platform'
+ );
+
+ ent_array ents_array;
+
+ begin
+
+ ent_array := ents_array();
+
+ for sg in server_groups loop
+ ent_array.extend;
+ ent_array(ent_array.count) := sg.label;
+ end loop;
+
+ return ent_array;
+
+ end get_server_entitlement;
+
+
+ -- this desperately needs to be table driven.
+ procedure modify_org_service (
+ org_id_in in number,
+ service_label_in in varchar2,
+ enable_in in char
+ ) is
+ type roles_v is varray(10) of rhnUserGroupType.label%TYPE;
+ roles_to_process roles_v;
+ cursor roles(role_label_in in varchar2) is
+ select label, id
+ from rhnUserGroupType
+ where label = role_label_in;
+ cursor org_roles(role_label_in in varchar2) is
+ select 1
+ from rhnUserGroup ug,
+ rhnUserGroupType ugt
+ where ugt.label = role_label_in
+ and ug.org_id = org_id_in
+ and ugt.id = ug.group_type;
+
+ type ents_v is varray(10) of rhnOrgEntitlementType.label%TYPE;
+ ents_to_process ents_v;
+ cursor ents(ent_label_in in varchar2) is
+ select label, id
+ from rhnOrgEntitlementType
+ where label = ent_label_in;
+ cursor org_ents(ent_label_in in varchar2) is
+ select 1
+ from rhnOrgEntitlements oe,
+ rhnOrgEntitlementType oet
+ where oet.label = ent_label_in
+ and oe.org_id = org_id_in
+ and oet.id = oe.entitlement_id;
+ create_row char(1);
+ begin
+ ents_to_process := ents_v();
+ roles_to_process := roles_v();
+ -- a bit kludgy, but only for 3.4 really. Certainly no
+ -- worse than the old code...
+ if service_label_in = 'enterprise' or
+ service_label_in = 'management' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) := 'sw_mgr_enterprise';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'org_admin';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'system_group_admin';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'activation_key_admin';
+ elsif service_label_in = 'provisioning' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) := 'rhn_provisioning';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'system_group_admin';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'activation_key_admin';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'config_admin';
+ -- another nasty special case...
+ if enable_in = 'Y' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) := 'sw_mgr_enterprise';
+ end if;
+ elsif service_label_in = 'monitoring' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) := 'rhn_monitor';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'monitoring_admin';
+ elsif service_label_in = 'virtualization' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) := 'rhn_virtualization';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'config_admin';
+ elsif service_label_in = 'virtualization_platform' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) :=
'rhn_virtualization_platform';
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'config_admin';
+ elsif service_label_in = 'nonlinux' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) := 'rhn_nonlinux';
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'config_admin';
+ end if;
+
+ if enable_in = 'Y' then
+ for i in 1..ents_to_process.count loop
+ for ent in ents(ents_to_process(i)) loop
+ create_row := 'Y';
+ for oe in org_ents(ent.label) loop
+ create_row := 'N';
+ end loop;
+ if create_row = 'Y' then
+ insert into rhnOrgEntitlements(org_id, entitlement_id)
+ values (org_id_in, ent.id);
+ end if;
+ end loop;
+ end loop;
+ for i in 1..roles_to_process.count loop
+ for role in roles(roles_to_process(i)) loop
+ create_row := 'Y';
+ for o_r in org_roles(role.label) loop
+ create_row := 'N';
+ end loop;
+ if create_row = 'Y' then
+ insert into rhnUserGroup(
+ id, name, description, current_members,
+ group_type, org_id
+ ) (
+ select rhn_user_group_id_seq.nextval,
+ ugt.name || 's',
+ ugt.name || 's for Org ' ||
+ o.name || ' ('|| o.id ||')',
+ 0, ugt.id, o.id
+ from rhnUserGroupType ugt,
+ web_customer o
+ where o.id = org_id_in
+ and ugt.id = role.id
+ );
+ end if;
+ end loop;
+ end loop;
+ else
+ for i in 1..ents_to_process.count loop
+ for ent in ents(ents_to_process(i)) loop
+ delete from rhnOrgEntitlements
+ where org_id = org_id_in
+ and entitlement_id = ent.id;
+ end loop;
+ end loop;
+ end if;
+ end modify_org_service;
+
+ procedure set_customer_enterprise (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'enterprise', 'Y');
+ end set_customer_enterprise;
+
+ procedure set_customer_provisioning (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'provisioning', 'Y');
+ end set_customer_provisioning;
+
+ procedure set_customer_monitoring (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'monitoring', 'Y');
+ end set_customer_monitoring;
+
+ procedure set_customer_nonlinux (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'nonlinux', 'Y');
+ end set_customer_nonlinux;
+
+ procedure unset_customer_enterprise (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'enterprise', 'N');
+ end unset_customer_enterprise;
+
+ procedure unset_customer_provisioning (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'provisioning', 'N');
+ end unset_customer_provisioning;
+
+ procedure unset_customer_monitoring (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'monitoring', 'N');
+ end unset_customer_monitoring;
+
+ procedure unset_customer_nonlinux (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'nonlinux', 'N');
+ end unset_customer_nonlinux;
+
+ -- *******************************************************************
+ -- PROCEDURE: prune_group
+ -- Unsubscribes servers consuming physical slots that over the org's
+ -- limit.
+ -- Called by: set_server_group_count, repoll_virt_guest_entitlements
+ -- *******************************************************************
+ procedure prune_group (
+ group_id_in in number,
+ quantity_in in number,
+ update_family_countsYN in number := 1
+ ) is
+ cursor servergroups is
+ select server_id, server_group_id, sgt.id as group_type_id, sgt.label
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg,
+ rhnServerGroupMembers sgm
+ where 1=1
+ and sgm.server_group_id = group_id_in
+ and sgm.server_id in (
+ select server_id
+ from (
+ select rownum row_number,
+ server_id,
+ time
+ from (
+ select sep.server_id,
+ sep.modified time
+ from
+ rhnServerEntitlementPhysical sep
+ where
+ sep.server_group_id = group_id_in
+ order by time asc
+ )
+ )
+ where row_number > quantity_in
+ )
+ and sgm.server_group_id = sg.id
+ and sg.group_type = sgt.id;
+ type_is_base char;
+ begin
+ update rhnServerGroup
+ set max_members = quantity_in
+ where id = group_id_in;
+
+ for sg in servergroups loop
+ remove_server_entitlement(sg.server_id, sg.label);
+
+ select is_base
+ into type_is_base
+ from rhnServerGroupType sgt
+ where sgt.id = sg.group_type_id;
+
+ -- if we're removing a base ent, then be sure to
+ -- remove the server's channel subscriptions.
+ if ( type_is_base = 'Y' ) then
+ rhn_channel.clear_subscriptions(sg.server_id,
+ update_family_countsYN =>
update_family_countsYN);
+ end if;
+
+ end loop;
+ end prune_group;
+
+ procedure set_server_group_count (
+ customer_id_in in number,
+ group_type_in in number,
+ quantity_in in number,
+ update_family_countsYN in number := 1
+ ) is
+ group_id number;
+ quantity number;
+ begin
+ quantity := quantity_in;
+ if quantity is not null and quantity < 0 then
+ quantity := 0;
+ end if;
+
+ select rsg.id
+ into group_id
+ from rhnServerGroup rsg
+ where 1=1
+ and rsg.org_id = customer_id_in
+ and rsg.group_type = group_type_in;
+
+ rhn_entitlements.prune_group(
+ group_id,
+ quantity,
+ update_family_countsYN
+ );
+ exception
+ when no_data_found then
+ insert into rhnServerGroup (
+ id, name, description, max_members, current_members,
+ group_type, org_id, created, modified
+ ) (
+ select rhn_server_group_id_seq.nextval, name, name,
+ quantity, 0, id, customer_id_in,
+ sysdate, sysdate
+ from rhnServerGroupType
+ where id = group_type_in
+ );
+ end set_server_group_count;
+
+ -- *******************************************************************
+ -- PROCEDURE: assign_system_entitlement
+ --
+ -- Moves system entitlements from from_org_id_in to to_org_id_in.
+ -- Can raise not_enough_entitlements_in_base_org if from_org_id_in
+ -- does not have enough entitlements to cover the move.
+ -- Takes care of unentitling systems if necessary by calling
+ -- set_server_group_count
+ -- *******************************************************************
+ procedure assign_system_entitlement(
+ group_label_in in varchar2,
+ from_org_id_in in number,
+ to_org_id_in in number,
+ quantity_in in number
+ )
+ is
+ prev_ent_count number;
+ to_org_prev_ent_count number;
+ new_ent_count number;
+ new_quantity number;
+ group_type number;
+ begin
+
+ begin
+ select max_members
+ into prev_ent_count
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg
+ where sg.org_id = from_org_id_in
+ and sg.group_type = sgt.id
+ and sgt.label = group_label_in;
+ exception
+ when NO_DATA_FOUND then
+ rhn_exception.raise_exception(
+ 'not_enough_entitlements_in_base_org');
+ end;
+
+ begin
+ select max_members
+ into to_org_prev_ent_count
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg
+ where sg.org_id = to_org_id_in
+ and sg.group_type = sgt.id
+ and sgt.label = group_label_in;
+ exception
+ when NO_DATA_FOUND then
+ to_org_prev_ent_count := 0;
+ end;
+
+ begin
+ select id
+ into group_type
+ from rhnServerGroupType
+ where label = group_label_in;
+ exception
+ when NO_DATA_FOUND then
+ rhn_exception.raise_exception(
+ 'invalid_server_group');
+ end;
+
+ new_ent_count := prev_ent_count - quantity_in;
+
+ if prev_ent_count > new_ent_count then
+ new_quantity := to_org_prev_ent_count + quantity_in;
+ end if;
+
+ if new_ent_count < 0 then
+ rhn_exception.raise_exception(
+ 'not_enough_entitlements_in_base_org');
+ end if;
+
+
+ set_server_group_count(from_org_id_in,
+ group_type,
+ new_ent_count);
+
+ set_server_group_count(to_org_id_in,
+ group_type,
+ new_quantity);
+
+ -- Create or delete the entries in rhnOrgEntitlementType
+ if group_label_in = 'enterprise_entitled' then
+ if new_quantity > 0 then
+ set_customer_enterprise(to_org_id_in);
+ else
+ unset_customer_enterprise(to_org_id_in);
+ end if;
+ end if;
+
+ if group_label_in = 'provisioning_entitled' then
+ if new_quantity > 0 then
+ set_customer_provisioning(to_org_id_in);
+ else
+ unset_customer_provisioning(to_org_id_in);
+ end if;
+ end if;
+
+ if group_label_in = 'monitoring_entitled' then
+ if new_quantity > 0 then
+ set_customer_monitoring(to_org_id_in);
+ else
+ unset_customer_monitoring(to_org_id_in);
+ end if;
+ end if;
+
+ end assign_system_entitlement;
+
+ -- *******************************************************************
+ -- PROCEDURE: assign_channel_entitlement
+ --
+ -- Moves channel entitlements from from_org_id_in to to_org_id_in.
+ -- Can raise not_enough_entitlements_in_base_org if from_org_id_in
+ -- does not have enough entitlements to cover the move.
+ -- Takes care of unentitling systems if necessary by calling
+ -- set_family_count
+ -- *******************************************************************
+ procedure assign_channel_entitlement(
+ channel_family_label_in in varchar2,
+ from_org_id_in in number,
+ to_org_id_in in number,
+ quantity_in in number,
+ flex_in in number
+ )
+ is
+ from_org_prev_ent_count number;
+ from_org_prev_ent_count_flex number;
+ new_ent_count number;
+ new_ent_count_flex number;
+ to_org_prev_ent_count number;
+ to_org_prev_ent_count_flex number;
+ new_quantity number;
+ new_flex number;
+ cfam_id number;
+ begin
+
+ begin
+ select max_members
+ into from_org_prev_ent_count
+ from rhnChannelFamily cf,
+ rhnPrivateChannelFamily pcf
+ where pcf.org_id = from_org_id_in
+ and pcf.channel_family_id = cf.id
+ and cf.label = channel_family_label_in;
+ exception
+ when NO_DATA_FOUND then
+ rhn_exception.raise_exception(
+ 'not_enough_entitlements_in_base_org');
+ end;
+
+ begin
+ select max_members
+ into to_org_prev_ent_count
+ from rhnChannelFamily cf,
+ rhnPrivateChannelFamily pcf
+ where pcf.org_id = to_org_id_in
+ and pcf.channel_family_id = cf.id
+ and cf.label = channel_family_label_in;
+ exception
+ when NO_DATA_FOUND then
+ to_org_prev_ent_count := 0;
+ end;
+
+ begin
+ select fve_max_members
+ into from_org_prev_ent_count_flex
+ from rhnChannelFamily cf,
+ rhnPrivateChannelFamily pcf
+ where pcf.org_id = from_org_id_in
+ and pcf.channel_family_id = cf.id
+ and cf.label = channel_family_label_in;
+ exception
+ when NO_DATA_FOUND then
+ rhn_exception.raise_exception(
+ 'not_enough_flex_entitlements_in_base_org');
+ end;
+
+ begin
+ select fve_max_members
+ into to_org_prev_ent_count_flex
+ from rhnChannelFamily cf,
+ rhnPrivateChannelFamily pcf
+ where pcf.org_id = to_org_id_in
+ and pcf.channel_family_id = cf.id
+ and cf.label = channel_family_label_in;
+ exception
+ when NO_DATA_FOUND then
+ to_org_prev_ent_count_flex := 0;
+ end;
+
+ begin
+ select id
+ into cfam_id
+ from rhnChannelFamily
+ where label = channel_family_label_in;
+ exception
+ when NO_DATA_FOUND then
+ rhn_exception.raise_exception(
+ 'invalid_channel_family');
+ end;
+
+ new_ent_count := from_org_prev_ent_count - quantity_in;
+ new_ent_count_flex := from_org_prev_ent_count_flex - flex_in;
+
+ if from_org_prev_ent_count >= new_ent_count then
+ new_quantity := to_org_prev_ent_count + quantity_in;
+ end if;
+
+ if from_org_prev_ent_count_flex >= new_ent_count_flex then
+ new_flex := to_org_prev_ent_count_flex + flex_in;
+ end if;
+
+
+ if new_ent_count < 0 then
+ rhn_exception.raise_exception(
+ 'not_enough_entitlements_in_base_org');
+ end if;
+
+ if new_ent_count_flex < 0 then
+ rhn_exception.raise_exception(
+ 'not_enough_flex_entitlements_in_base_org');
+ end if;
+
+
+
+ rhn_entitlements.set_family_count(from_org_id_in, cfam_id,
+ new_ent_count, new_ent_count_flex);
+
+ rhn_entitlements.set_family_count(to_org_id_in,
+ cfam_id,
+ new_quantity, new_flex);
+
+ end assign_channel_entitlement;
+
+ -- *******************************************************************
+ -- PROCEDURE: activate_system_entitlement
+ --
+ -- Sets the values in rhnServerGroup for a given rhnServerGroupType.
+ --
+ -- Calls: set_server_group_count to update, prune, or create the group.
+ -- Called by: the code that activates a satellite cert.
+ --
+ -- Raises not_enough_entitlements_in_base_org if all entitlements
+ -- in the org are used so the free entitlements would not cover
+ -- the difference when descreasing the number of entitlements.
+ -- *******************************************************************
+ procedure activate_system_entitlement(
+ org_id_in in number,
+ group_label_in in varchar2,
+ quantity_in in number
+ )
+ is
+ prev_ent_count number;
+ prev_ent_count_sum number;
+ group_type number;
+ begin
+
+ -- Fetch the current entitlement count for the org
+ -- into prev_ent_count
+ begin
+ select current_members
+ into prev_ent_count
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg
+ where sg.group_type = sgt.id
+ and sgt.label = group_label_in
+ and sg.org_id = org_id_in;
+ exception
+ when NO_DATA_FOUND then
+ prev_ent_count := 0;
+ end;
+
+ begin
+ select id
+ into group_type
+ from rhnServerGroupType
+ where label = group_label_in;
+ exception
+ when NO_DATA_FOUND then
+ rhn_exception.raise_exception(
+ 'invalid_server_group');
+ end;
+
+ -- If we're setting the total entitlemnt count to a lower value,
+ -- and that value is less than the allocated count in this org,
+ -- we need to raise an exception.
+ if quantity_in < prev_ent_count then
+ rhn_exception.raise_exception(
+ 'not_enough_entitlements_in_base_org');
+ else
+ -- don't update family counts after every server
+ -- will do bulk update afterwards
+ set_server_group_count(org_id_in,
+ group_type,
+ quantity_in,
+ update_family_countsYN => 0);
+ -- bulk update family counts
+ rhn_channel.update_group_family_counts(group_label_in, org_id_in);
+ end if;
+
+
+ end activate_system_entitlement;
+
+ -- *******************************************************************
+ -- PROCEDURE: activate_channel_entitlement
+ --
+ -- Calls: set_family_count to update, prune, or create the family
+ -- permission bucket.
+ -- Called by: the code that activates a satellite cert.
+ --
+ -- Raises not_enough_entitlements_in_base_org if there are not enough
+ -- entitlements in the org to cover the difference when you are
+ -- descreasing the number of entitlements.
+ --
+ -- The backend code in Python is expected to do whatever arithmetics
+ -- is needed.
+ -- *******************************************************************
+ procedure activate_channel_entitlement(
+ org_id_in in number,
+ channel_family_label_in in varchar2,
+ quantity_in in number,
+ flex_in in number
+
+ )
+ is
+ prev_ent_count number;
+ prev_flex_count number;
+ prev_ent_count_sum number;
+ cfam_id number;
+ reduce_quantity number;
+ total_flex_capable number;
+ cursor to_convert_reg (channel_family_id_val in number, org_id_in in number,
quantity in number)
+ is
+ select SC.server_id
+ from rhnServerChannel SC inner join
+ rhnServer S on S.id = SC.server_id
+ where
+ is_fve = 'Y'
+ and S.org_id = org_id_in
+ and SC.channel_id in
+ (select cfm.channel_id from rhnChannelFamilyMembers cfm
+ where cfm.CHANNEL_FAMILY_ID = channel_family_id_val)
+ and rownum <= quantity;
+ cursor to_convert_flex (channel_family_id_val in number, org_id_in in number,
quantity in number)
+ is
+ select server_id
+ from rhnServerFveCapable
+ where SERVER_ORG_ID = org_id_in and
+ channel_family_id = cfam_id and
+ rownum <= quantity;
+
+ begin
+
+ -- Fetch the current entitlement count for the org
+ -- into prev_ent_count
+ begin
+ select current_members
+ into prev_ent_count
+ from rhnChannelFamily cf,
+ rhnPrivateChannelFamily pcf
+ where pcf.org_id = org_id_in
+ and pcf.channel_family_id = cf.id
+ and cf.label = channel_family_label_in;
+ exception
+ when NO_DATA_FOUND then
+ prev_ent_count := 0;
+ end;
+
+ begin
+ select pcf.fve_current_members
+ into prev_flex_count
+ from rhnChannelFamily cf,
+ rhnPrivateChannelFamily pcf
+ where pcf.org_id = org_id_in
+ and pcf.channel_family_id = cf.id
+ and cf.label = channel_family_label_in;
+ exception
+ when NO_DATA_FOUND then
+ prev_flex_count := 0;
+ end;
+
+
+ begin
+ select id
+ into cfam_id
+ from rhnChannelFamily
+ where label = channel_family_label_in;
+ exception
+ when NO_DATA_FOUND then
+ rhn_exception.raise_exception(
+ 'invalid_channel_family');
+ end;
+
+ -- if there are too few flex entitlements
+ if flex_in < prev_flex_count then
+ -- and if the extra we need is less than or equal to our extra regular
entitlements
+ if prev_flex_count - flex_in <= quantity_in - prev_ent_count then
+ reduce_quantity := prev_flex_count - flex_in;
+ -- We need to convert some systems from flex guest to regular
+ for system in to_convert_reg(cfam_id, org_id_in, reduce_quantity)
loop
+ --rhn_channel.convert_to_regular(system.server_id, cfam_id);
+ UPDATE rhnServerChannel sc set sc.is_fve = 'N'
+ where sc.server_id = system.server_id
+ and sc.channel_id in (select cfm.channel_id
+ from rhnChannelFamilyMembers
cfm
+ where cfm.channel_family_id =
cfam_id);
+ end loop;
+
+ --reset previous counts
+ prev_ent_count := prev_ent_count + reduce_quantity;
+ prev_flex_count := prev_flex_count - reduce_quantity;
+ else
+ rhn_exception.raise_exception(
+ 'not_enough_flex_entitlements_in_base_org');
+ end if;
+ end if;
+
+ -- if there are too few regular entitlements, and extra flex entitlements
+ if quantity_in < prev_ent_count and prev_flex_count < flex_in then
+ -- how many flex-capable systems (that aren't using flex) do we have
+ select count(*)
+ into total_flex_capable
+ from rhnServerFveCapable
+ where SERVER_ORG_ID = org_id_in and
+ channel_family_id = cfam_id;
+ -- if we have enough flex capable machines that is at least
+ -- as many as what we are over on
+ if total_flex_capable >= prev_ent_count - quantity_in then
+ reduce_quantity := prev_ent_count - quantity_in;
+ for system in to_convert_flex(cfam_id, org_id_in, reduce_quantity)
loop
+-- rhn_channel.convert_to_fve(system.server_id, cfam_id);
+ UPDATE rhnServerChannel sc set sc.is_fve = 'Y'
+ where sc.server_id = system.server_id
+ and sc.channel_id in (select cfm.channel_id
+ from rhnChannelFamilyMembers
cfm
+ where cfm.channel_family_id =
cfam_id);
+ end loop;
+ prev_ent_count := prev_ent_count - reduce_quantity;
+ prev_flex_count := prev_flex_count + reduce_quantity;
+ end if;
+ end if;
+
+
+
+
+ -- If we're setting the total entitlemnt count to a lower value,
+ -- and that value is less than the count in that one org,
+ -- we need to raise an exception.
+ if quantity_in < prev_ent_count then
+ rhn_exception.raise_exception(
+ 'not_enough_entitlements_in_base_org');
+ else
+ -- even if we've manually converted systems to/from flex above
+ -- set_family_count should call update_family_counts, to reset
+ -- current used slots
+ rhn_entitlements.set_family_count(org_id_in, cfam_id,
+ quantity_in, flex_in);
+ end if;
+
+ end activate_channel_entitlement;
+
+
+ -- *******************************************************************
+ -- PROCEDURE: prune_family
+ -- Unsubscribes servers consuming physical slots from the channel family
+ -- that are over the org's limit.
+ -- Called by: set_family_count
+ -- *******************************************************************
+ procedure prune_family (
+ customer_id_in in number,
+ channel_family_id_in in number,
+ quantity_in in number,
+ flex_in in number
+ ) is
+ is_fve_in char;
+ tmp_quantity number;
+
+ cursor serverchannels is
+ select sc.server_id,
+ sc.channel_id
+ from rhnServerChannel sc,
+ rhnChannelFamilyMembers cfm
+ where 1=1
+ and cfm.channel_family_id = channel_family_id_in
+ and cfm.channel_id = sc.channel_id
+ and server_id in (
+ select server_id
+ from (
+ select server_id, time, rownum row_number
+ from (
+ select rs.id server_id, rcfm.modified time
+ from rhnServerChannel rsc,
+ rhnChannelFamilyMembers rcfm,
+ rhnServer rs
+ where 1=1
+ and rs.org_id = customer_id_in
+ and rs.id = rsc.server_id
+ and rsc.channel_id = rcfm.channel_id
+ and rcfm.channel_family_id = channel_family_id_in
+ and rsc.is_fve = is_fve_in
+ -- we only want to grab servers consuming
+ -- physical slots.
+ and exists (
+ select 1
+ from rhnChannelFamilyServerPhysical cfsp
+ where cfsp.server_id = rs.id
+ and cfsp.channel_family_id =
+ channel_family_id_in
+ )
+ order by time asc
+ )
+ )
+ where row_number > tmp_quantity
+ );
+ begin
+ -- if we get a null customer_id, this is completely bogus.
+ if customer_id_in is null then
+ return;
+ end if;
+
+ tmp_quantity := quantity_in;
+ is_fve_in := 'N';
+
+ for sc in serverchannels loop
+ rhn_channel.unsubscribe_server(sc.server_id, sc.channel_id, 1, 1,
+ update_family_countsYN => 0);
+
+ tmp_quantity := flex_in;
+ is_fve_in := 'Y';
+ for sc in serverchannels loop
+ rhn_channel.unsubscribe_server(sc.server_id, sc.channel_id, 1, 1,
+ update_family_countsYN => 0);
+ end loop;
+
+
+
+ end loop;
+ rhn_channel.update_family_counts(channel_family_id_in, customer_id_in);
+ end prune_family;
+
+ procedure set_family_count (
+ customer_id_in in number,
+ channel_family_id_in in number,
+ quantity_in in number,
+ flex_in in number
+ ) is
+ cursor privperms is
+ select 1
+ from rhnPrivateChannelFamily
+ where org_id = customer_id_in
+ and channel_family_id = channel_family_id_in;
+ cursor pubperms is
+ select o.id org_id
+ from web_customer o,
+ rhnPublicChannelFamily pcf
+ where pcf.channel_family_id = channel_family_id_in;
+ quantity number;
+ done number := 0;
+ flex number;
+ begin
+ quantity := quantity_in;
+ if quantity is not null and quantity < 0 then
+ quantity := 0;
+ end if;
+ flex := flex_in;
+ if flex is not null and flex < 0 then
+ flex := 0;
+ end if;
+
+
+ if customer_id_in is not null then
+ for perm in privperms loop
+ rhn_entitlements.prune_family(customer_id_in, channel_family_id_in,
+ quantity, flex);
+
+ if quantity is null and flex is null then
+ delete from rhnPrivateChannelFamily
+ where org_id = customer_id_in
+ and channel_family_id = channel_family_id_in;
+ else
+ update rhnPrivateChannelFamily
+ set max_members = quantity
+ where org_id = customer_id_in
+ and channel_family_id = channel_family_id_in;
+
+ update rhnPrivateChannelFamily
+ set fve_max_members = flex
+ where org_id = customer_id_in
+ and channel_family_id = channel_family_id_in;
+ end if;
+ return;
+ end loop;
+
+ insert into rhnPrivateChannelFamily (
+ channel_family_id, org_id, max_members, current_members,
fve_max_members, fve_current_members
+ ) values (
+ channel_family_id_in, customer_id_in, quantity, 0, flex, 0 );
+ return;
+ end if;
+
+ for perm in pubperms loop
+ if quantity = 0 then
+ rhn_entitlements.prune_family(
+ perm.org_id,
+ channel_family_id_in,
+ quantity,
+ flex
+ );
+ if done = 0 then
+ delete from rhnPublicChannelFamily
+ where channel_family_id = channel_family_id_in;
+ end if;
+ end if;
+ done := 1;
+ end loop;
+ -- if done's not 1, then we don't have any entitlements
+ if done != 1 then
+ insert into rhnPublicChannelFamily (
+ channel_family_id
+ ) values (
+ channel_family_id_in
+ );
+ end if;
+ end set_family_count;
+
+ -- this expects quantity_in to be the number of available slots, not the
+ -- max_members of the server group. If you give it too many, it'll fail
+ -- and raise servergroup_max_members.
+ -- We should NEVER run this unless we're SURE that we won't
+ -- be violating the max.
+ procedure entitle_last_modified_servers (
+ customer_id_in in number,
+ type_label_in in varchar2,
+ quantity_in in number
+ ) is
+ -- find the servers that aren't currently in slots
+ cursor servers(cid_in in number, quant_in in number) is
+ select server_id
+ from (
+ select rownum row_number,
+ server_id
+ from (
+ select rs.id server_iD
+ from rhnServer rs
+ where 1=1
+ and rs.org_id = cid_in
+ and not exists (
+ select 1
+ from rhnServerGroup sg,
+ rhnServerGroupMembers rsgm
+ where rsgm.server_id = rs.id
+ and rsgm.server_group_id = sg.id
+ and sg.group_type is not null
+ )
+ and not exists (
+ select 1
+ from rhnVirtualInstance vi
+ where vi.virtual_system_id =
+ rs.id
+ )
order by modified desc
+ )
+ )
+ where row_number <= quant_in;
+ begin
+ for server in servers(customer_id_in, quantity_in) loop
+ rhn_entitlements.entitle_server(server.server_id, type_label_in);
+ end loop;
+ end entitle_last_modified_servers;
+
+ procedure subscribe_newest_servers (
+ customer_id_in in number
+ ) is
+ -- find servers without base channels
+ cursor servers(cid_in in number) is
+ select s.id
+ from rhnServer s
+ where 1=1
+ and s.org_id = cid_in
+ and not exists (
+ select 1
+ from rhnChannel c,
+ rhnServerChannel sc
+ where sc.server_id = s.id
+ and sc.channel_id = c.id
+ and c.parent_channel is null
+ )
+ and not exists (
+ select 1
+ from rhnVirtualInstance vi
+ where vi.virtual_system_id = s.id
+ )
+ order by s.modified desc;
+ channel_id number;
+ begin
+ for server in servers(customer_id_in) loop
+ channel_id := rhn_channel.guess_server_base(server.id);
+ if channel_id is not null then
+ begin
+ rhn_channel.subscribe_server(server.id, channel_id);
+ commit;
+ -- exception is really channel_family_no_subscriptions
+ exception
+ when others then
+ null;
+ end;
+ end if;
+ end loop;
+ end subscribe_newest_servers;
+end rhn_entitlements;
+/
+show errors
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/120-rhn_entitlements.pkb.postgresql
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/120-rhn_entitlements.pkb.postgresql
new file mode 100644
index 0000000..4291abb
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/120-rhn_entitlements.pkb.postgresql
@@ -0,0 +1,132 @@
+-- oracle equivalent source sha1 59c6bda096f0db5a00764d92dea6e6101656cfbd
+--
+-- setup search_path so that these functions are created in appropriate schema.
+update pg_settings set setting = 'rhn_entitlements,' || setting where name =
'search_path';
+
+ -- this desperately needs to be table driven.
+ create or replace function modify_org_service (
+ org_id_in in numeric,
+ service_label_in in varchar,
+ enable_in in char
+ ) returns void
+as $$
+ declare
+ roles_to_process varchar[];
+ roles cursor(role_label_in varchar) for
+ select label, id
+ from rhnUserGroupType
+ where label = role_label_in;
+ org_roles cursor(role_label_in varchar) for
+ select 1
+ from rhnUserGroup ug,
+ rhnUserGroupType ugt
+ where ugt.label = role_label_in
+ and ug.org_id = org_id_in
+ and ugt.id = ug.group_type;
+
+ ents_to_process varchar[];
+ ents cursor(ent_label_in varchar) for
+ select label, id
+ from rhnOrgEntitlementType
+ where label = ent_label_in;
+ org_ents cursor(ent_label_in varchar) for
+ select 1
+ from rhnOrgEntitlements oe,
+ rhnOrgEntitlementType oet
+ where oet.label = ent_label_in
+ and oe.org_id = org_id_in
+ and oet.id = oe.entitlement_id;
+ create_row char(1);
+ begin
+ ents_to_process := '{}';
+ roles_to_process := '{}';
+ -- a bit kludgy, but only for 3.4 really. Certainly no
+ -- worse than the old code...
+ if service_label_in = 'enterprise' or
+ service_label_in = 'management' then
+ ents_to_process := array_append(ents_to_process,
'sw_mgr_enterprise');
+
+ roles_to_process := array_append(roles_to_process, 'org_admin');
+
+ roles_to_process := array_append(roles_to_process,
'system_group_admin');
+
+ roles_to_process := array_append(roles_to_process,
'activation_key_admin');
+ elsif service_label_in = 'provisioning' then
+ ents_to_process := array_append(ents_to_process,
'rhn_provisioning');
+
+ roles_to_process := array_append(roles_to_process,
'system_group_admin');
+
+ roles_to_process := array_append(roles_to_process,
'activation_key_admin');
+
+ roles_to_process := array_append(roles_to_process, 'config_admin');
+ -- another nasty special case...
+ if enable_in = 'Y' then
+ ents_to_process := array_append(ents_to_process,
'sw_mgr_enterprise');
+ end if;
+ elsif service_label_in = 'monitoring' then
+ ents_to_process := array_append(ents_to_process, 'rhn_monitor');
+
+ roles_to_process := array_append(roles_to_process,
'monitoring_admin');
+ elsif service_label_in = 'virtualization' then
+ ents_to_process := array_append(ents_to_process,
'rhn_virtualization');
+
+ roles_to_process := array_append(roles_to_process, 'config_admin');
+ elsif service_label_in = 'virtualization_platform' then
+ ents_to_process := array_append(ents_to_process,
'rhn_virtualization_platform');
+ roles_to_process := array_append(roles_to_process, 'config_admin');
+ elsif service_label_in = 'nonlinux' then
+ ents_to_process := array_append(ents_to_process, 'rhn_nonlinux');
+ roles_to_process := array_append(roles_to_process, 'config_admin');
+ end if;
+
+ if enable_in = 'Y' then
+ for i in 1..array_upper(ents_to_process, 1) loop
+ for ent in ents(ents_to_process[i]) loop
+ create_row := 'Y';
+ for oe in org_ents(ent.label) loop
+ create_row := 'N';
+ end loop;
+ if create_row = 'Y' then
+ insert into rhnOrgEntitlements(org_id, entitlement_id)
+ values (org_id_in, ent.id);
+ end if;
+ end loop;
+ end loop;
+ for i in 1..array_upper(roles_to_process, 1) loop
+ for role in roles(roles_to_process[i]) loop
+ create_row := 'Y';
+ for o_r in org_roles(role.label) loop
+ create_row := 'N';
+ end loop;
+ if create_row = 'Y' then
+ insert into rhnUserGroup(
+ id, name, description, current_members,
+ group_type, org_id
+ ) (
+ select nextval('rhn_user_group_id_seq'),
+ ugt.name || 's',
+ ugt.name || 's for Org ' ||
+ o.name || ' ('|| o.id ||')',
+ 0, ugt.id, o.id
+ from rhnUserGroupType ugt,
+ web_customer o
+ where o.id = org_id_in
+ and ugt.id = role.id
+ );
+ end if;
+ end loop;
+ end loop;
+ else
+ for i in 1..coalesce(array_upper(ents_to_process, 1), 0) loop
+ for ent in ents(ents_to_process[i]) loop
+ delete from rhnOrgEntitlements
+ where org_id = org_id_in
+ and entitlement_id = ent.id;
+ end loop;
+ end loop;
+ end if;
+ end$$
+language plpgsql;
+
+-- restore the original setting
+update pg_settings set setting = overlay( setting placing '' from 1 for
(length('rhn_entitlements')+1) ) where name = 'search_path';
commit b62de9ee81ea90e7b3e0799cf1df236c038330c3
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 15:53:24 2012 +0200
remove unused is_user_applicant function
diff --git a/schema/spacewalk/oracle/procs/is_user_applicant.sql
b/schema/spacewalk/oracle/procs/is_user_applicant.sql
deleted file mode 100644
index 267e9d8..0000000
--- a/schema/spacewalk/oracle/procs/is_user_applicant.sql
+++ /dev/null
@@ -1,57 +0,0 @@
---
--- Copyright (c) 2008 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
-is_user_applicant
-(
- user_id_in IN number
-)
-return number
-is
- org_id_val number;
- app_group_val number;
- applicant number;
-begin
- select org_id into org_id_val
- from web_contact
- where id = user_id_in;
-
- select id into app_group_val
- from rhnUserGroup
- where org_id = org_id_val
- and group_type = (
- select id
- from rhnUserGroupType
- where label = 'org_applicant'
- );
-
- select count(1) into applicant
- from rhnUserGroupMembers
- where user_group_id = app_group_val
- and user_id = user_id_in;
-
- return applicant;
-end;
-/
-show errors
-
---
--- Revision 1.3 2002/05/13 22:53:38 pjones
--- cvs id/log
--- some (note enough) readability fixes
---
diff --git a/schema/spacewalk/oracle/procs/procs.deps
b/schema/spacewalk/oracle/procs/procs.deps
index 8202c57..7917ff9 100644
--- a/schema/spacewalk/oracle/procs/procs.deps
+++ b/schema/spacewalk/oracle/procs/procs.deps
@@ -74,8 +74,6 @@ insert_transaction_package :: rhnTransactionPackage
insert_xccdf_benchmark :: rhnXccdfBenchmark
insert_xccdf_ident_system :: rhnXccdfIdentSystem
insert_xccdf_profile :: rhnXccdfProfile
-is_user_applicant :: rhnUserGroupType web_contact rhnUserGroup \
- rhnUserGroupMembers
lookup_arch_type :: data/rhnArchType rhn_exception.pks
lookup_channel_arch :: rhn_exception.pks data/rhnException rhnChannelArch \
data/rhnChannelArch
diff --git a/schema/spacewalk/postgres/procs/is_user_applicant.sql
b/schema/spacewalk/postgres/procs/is_user_applicant.sql
deleted file mode 100644
index 07790ca..0000000
--- a/schema/spacewalk/postgres/procs/is_user_applicant.sql
+++ /dev/null
@@ -1,53 +0,0 @@
--- oracle equivalent source sha1 cf15e2c07c38e123ce7c7c8961e38f5bc95b7da2
--- retrieved from
./1235561447/a7740e6945947b753ef3359998c3a103d464f765/schema/spacewalk/rhnsat/procs/is_user_applicant.sql
---
--- Copyright (c) 2008--2010 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
-is_user_applicant
-(
- user_id_in IN numeric
-)
-returns numeric
-as $$
-declare
- org_id_val numeric;
- app_group_val numeric;
- applicant numeric;
-begin
- select org_id into org_id_val
- from web_contact
- where id = user_id_in;
-
- select id into app_group_val
- from rhnUserGroup
- where org_id = org_id_val
- and group_type = (
- select id
- from rhnUserGroupType
- where label = 'org_applicant'
- );
-
- select count(1) into applicant
- from rhnUserGroupMembers
- where user_group_id = app_group_val
- and user_id = user_id_in;
-
- return applicant;
-end;
-$$
-language plpgsql;
diff --git a/schema/spacewalk/postgres/procs/procs.deps
b/schema/spacewalk/postgres/procs/procs.deps
index d9ca05d..187bbbd 100644
--- a/schema/spacewalk/postgres/procs/procs.deps
+++ b/schema/spacewalk/postgres/procs/procs.deps
@@ -59,8 +59,6 @@ delete_server :: rhn_channel.pks rhn_config.pks \
rhnServerEntitlementView
delete_server_bulk :: delete_server
does_user_have_role :: rhnUserGroup rhnUserGroupMembers rhnUserGroupType
-is_user_applicant :: rhnUserGroupType web_contact rhnUserGroup \
- rhnUserGroupMembers
lookup_arch_type :: data/rhnArchType rhn_exception.pks
lookup_channel_arch :: rhn_exception.pks data/rhnException rhnChannelArch \
data/rhnChannelArch
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/117-is_user_applicant.sql
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/117-is_user_applicant.sql
new file mode 100644
index 0000000..ea74b1e
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/117-is_user_applicant.sql
@@ -0,0 +1 @@
+DROP FUNCTION is_user_applicant;
commit dfbd266f9a742f98c0ffba2842874b6974fd19d6
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 15:48:04 2012 +0200
remove unused org_applicant user role from creating new orgs
diff --git a/schema/spacewalk/oracle/procs/create_first_org.sql
b/schema/spacewalk/oracle/procs/create_first_org.sql
index bc2ac5a..65e9d5a 100644
--- a/schema/spacewalk/oracle/procs/create_first_org.sql
+++ b/schema/spacewalk/oracle/procs/create_first_org.sql
@@ -55,23 +55,6 @@ begin
select id
into ug_type
from rhnUserGroupType
- where label = 'org_applicant';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) VALues (
- group_val, 'Organization Applicants',
- 'Organization Applicants for Org ' || name_in || ' (1)',
- NULL, ug_type, 1
- );
-
- select rhn_user_group_id_seq.nextval into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
where label = 'system_group_admin';
insert into rhnUserGroup (
diff --git a/schema/spacewalk/oracle/procs/create_new_org.sql
b/schema/spacewalk/oracle/procs/create_new_org.sql
index b3dc517..1359e64 100644
--- a/schema/spacewalk/oracle/procs/create_new_org.sql
+++ b/schema/spacewalk/oracle/procs/create_new_org.sql
@@ -57,23 +57,6 @@ begin
select id
into ug_type
from rhnUserGroupType
- where label = 'org_applicant';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) VALues (
- group_val, 'Organization Applicants',
- 'Organization Applicants for Org ' || name_in,
- NULL, ug_type, new_org_id
- );
-
- select rhn_user_group_id_seq.nextval into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
where label = 'system_group_admin';
insert into rhnUserGroup (
diff --git a/schema/spacewalk/postgres/procs/create_first_org.sql
b/schema/spacewalk/postgres/procs/create_first_org.sql
index 93dd73f..f3f0e00 100644
--- a/schema/spacewalk/postgres/procs/create_first_org.sql
+++ b/schema/spacewalk/postgres/procs/create_first_org.sql
@@ -1,4 +1,4 @@
--- oracle equivalent source sha1 5ab67356ee6f35be89739cf5d31334fdf96596ac
+-- oracle equivalent source sha1 77c8eb10ea3d63cd683455e740162c43246851bc
-- retrieved from
./1279712605/e7eb734c1a1ae108af13b6aa9040c8f20aee64c5/schema/spacewalk/oracle/procs/create_first_org.sql
--
-- Copyright (c) 2008--2010 Red Hat, Inc.
@@ -58,23 +58,6 @@ begin
select id
into ug_type
from rhnUserGroupType
- where label = 'org_applicant';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) values (
- group_val, 'Organization Applicants',
- 'Organization Applicants for Org ' || name_in || ' (1)',
- NULL, ug_type, 1
- );
-
- select nextval('rhn_user_group_id_seq') into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
where label = 'system_group_admin';
insert into rhnUserGroup (
diff --git a/schema/spacewalk/postgres/procs/create_new_org.sql
b/schema/spacewalk/postgres/procs/create_new_org.sql
index 24eb006..6807aaf 100644
--- a/schema/spacewalk/postgres/procs/create_new_org.sql
+++ b/schema/spacewalk/postgres/procs/create_new_org.sql
@@ -1,4 +1,4 @@
--- oracle equivalent source sha1 9a93bedcf318008a701b88e86380a8d3cf353819
+-- oracle equivalent source sha1 0162ede8482479569e72b71371bcad1e421c7b7a
-- retrieved from
./1279712605/e7eb734c1a1ae108af13b6aa9040c8f20aee64c5/schema/spacewalk/oracle/procs/create_new_org.sql
--
-- Copyright (c) 2008--2010 Red Hat, Inc.
@@ -60,23 +60,6 @@ begin
select id
into ug_type
from rhnUserGroupType
- where label = 'org_applicant';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) VALues (
- group_val, 'Organization Applicants',
- 'Organization Applicants for Org ' || name_in,
- NULL, ug_type, new_org_id
- );
-
- select nextval('rhn_user_group_id_seq') into group_val;
-
- select id
- into ug_type
- from rhnUserGroupType
where label = 'system_group_admin';
insert into rhnUserGroup (
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/118-create_first_org.sql.oracle
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/118-create_first_org.sql.oracle
new file mode 100644
index 0000000..9aa6a55
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/118-create_first_org.sql.oracle
@@ -0,0 +1,137 @@
+--
+-- Copyright (c) 2008--2010 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.
+--
+--
+-- This creates an org with ID of 1, and errors if there already is one
+--
+
+
+
+create or replace procedure
+create_first_org
+(
+ name_in in varchar2,
+ password_in in varchar2
+) is
+ ug_type number;
+ group_val number;
+begin
+ insert into web_customer (
+ id, name
+ ) values (
+ 1, name_in
+ );
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'org_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Organization Administrators',
+ 'Organization Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'system_group_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'System Group Administrators',
+ 'System Group Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'activation_key_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Activation Key Administrators',
+ 'Activation Key Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+ -- config admin is special; it gets created in
+ -- rhn_entitlements.set_customer_provisioning instead.
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'channel_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Channel Administrators',
+ 'Channel Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'satellite_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Satellite Administrators',
+ 'Satellite Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+
+ -- there aren't any users yet, so we don't need to update
+ -- rhnUserServerPerms
+ insert into rhnServerGroup
+ ( id, name, description, max_members, group_type, org_id )
+ select rhn_server_group_id_seq.nextval, sgt.name, sgt.name,
+ 0, sgt.id, 1
+ from rhnServerGroupType sgt
+ where sgt.label = 'sw_mgr_entitled';
+
+end create_first_org;
+/
+show errors;
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/118-create_first_org.sql.postgresql
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/118-create_first_org.sql.postgresql
new file mode 100644
index 0000000..fdefdce
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/118-create_first_org.sql.postgresql
@@ -0,0 +1,138 @@
+-- oracle equivalent source sha1 1a8c4b846f4948a5415a4179af498e87e716efd9
+--
+-- Copyright (c) 2008--2010 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.
+--
+--
+-- This creates an org with ID of 1, and errors if there already is one
+--
+
+create or replace function
+create_first_org
+(
+ name_in in varchar,
+ password_in in varchar
+)
+returns void as
+$$
+declare
+ ug_type numeric;
+ group_val numeric;
+begin
+ insert into web_customer (
+ id, name
+ ) values (
+ 1, name_in
+ );
+
+ select nextval( 'rhn_user_group_id_seq' ) into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'org_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Organization Administrators',
+ 'Organization Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+ select nextval('rhn_user_group_id_seq') into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'system_group_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'System Group Administrators',
+ 'System Group Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+
+ select nextval('rhn_user_group_id_seq') into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'activation_key_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Activation Key Administrators',
+ 'Activation Key Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+ -- config admin is special; it gets created in
+ -- rhn_entitlements.set_customer_provisioning instead.
+
+ select nextval('rhn_user_group_id_seq') into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'channel_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Channel Administrators',
+ 'Channel Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+ select nextval('rhn_user_group_id_seq') into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'satellite_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Satellite Administrators',
+ 'Satellite Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+
+ -- there aren't any users yet, so we don't need to update
+ -- rhnUserServerPerms
+ insert into rhnServerGroup
+ ( id, name, description, max_members, group_type, org_id )
+ select nextval('rhn_server_group_id_seq'), sgt.name, sgt.name,
+ 0, sgt.id, 1
+ from rhnServerGroupType sgt
+ where sgt.label = 'sw_mgr_entitled';
+
+end
+$$ language plpgsql;
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/119-create_new_org.sql.oracle
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/119-create_new_org.sql.oracle
new file mode 100644
index 0000000..55d598c
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/119-create_new_org.sql.oracle
@@ -0,0 +1,123 @@
+--
+-- Copyright (c) 2008--2010 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 procedure
+create_new_org
+(
+ name_in in varchar2,
+ password_in in varchar2,
+ org_id_out out number
+) is
+ ug_type number;
+ group_val number;
+ new_org_id number;
+begin
+
+ select web_customer_id_seq.nextval into new_org_id from dual;
+
+ insert into web_customer (
+ id, name
+
+
+ ) values (
+ new_org_id, name_in
+ );
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'org_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Organization Administrators',
+ 'Organization Administrators for Org ' || name_in,
+ NULL, ug_type, new_org_id
+ );
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'system_group_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'System Group Administrators',
+ 'System Group Administrators for Org ' || name_in,
+ NULL, ug_type, new_org_id
+ );
+
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'activation_key_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Activation Key Administrators',
+ 'Activation Key Administrators for Org ' || name_in,
+ NULL, ug_type, new_org_id
+ );
+
+ -- config admin is special; it gets created in
+ -- rhn_entitlements.set_customer_provisioning instead.
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'channel_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Channel Administrators',
+ 'Channel Administrators for Org ' || name_in,
+ NULL, ug_type, new_org_id
+ );
+
+ -- there aren't any users yet, so we don't need to update
+ -- rhnUserServerPerms
+ insert into rhnServerGroup
+ ( id, name, description, max_members, group_type, org_id )
+ select rhn_server_group_id_seq.nextval, sgt.name, sgt.name,
+ 0, sgt.id, new_org_id
+ from rhnServerGroupType sgt
+ where sgt.label = 'sw_mgr_entitled';
+
+ org_id_out := new_org_id;
+
+end create_new_org;
+/
+show errors;
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/119-create_new_org.sql.postgresql
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/119-create_new_org.sql.postgresql
new file mode 100644
index 0000000..993ae3b
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/119-create_new_org.sql.postgresql
@@ -0,0 +1,128 @@
+-- oracle equivalent source sha1 bffebbd6ff83f0d1f159394958b8f4b16b4f246c
+--
+-- Copyright (c) 2008--2010 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 create_new_org
+(
+ name_in in varchar,
+ password_in in varchar
+ --org_id_out out number
+) returns numeric
+as
+$$
+declare
+ ug_type numeric;
+ group_val numeric;
+ new_org_id numeric;
+ org_id_out numeric;
+begin
+
+ select nextval('web_customer_id_seq') into new_org_id;
+
+ insert into web_customer (
+ id, name
+ ) values (
+ new_org_id, name_in
+ );
+
+ select nextval('rhn_user_group_id_seq') into group_val;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'org_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Organization Administrators',
+ 'Organization Administrators for Org ' || name_in,
+ NULL, ug_type, new_org_id
+ );
+
+ select nextval('rhn_user_group_id_seq') into group_val;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'system_group_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'System Group Administrators',
+ 'System Group Administrators for Org ' || name_in,
+ NULL, ug_type, new_org_id
+ );
+
+
+ select nextval('rhn_user_group_id_seq') into group_val;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'activation_key_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Activation Key Administrators',
+ 'Activation Key Administrators for Org ' || name_in,
+ NULL, ug_type, new_org_id
+ );
+
+ -- config admin is special; it gets created in
+ -- rhn_entitlements.set_customer_provisioning instead.
+
+ select nextval('rhn_user_group_id_seq') into group_val;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'channel_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Channel Administrators',
+ 'Channel Administrators for Org ' || name_in,
+ NULL, ug_type, new_org_id
+ );
+
+ -- there aren't any users yet, so we don't need to update
+ -- rhnUserServerPerms
+ insert into rhnServerGroup
+ ( id, name, description, max_members, group_type, org_id )
+ select nextval('rhn_server_group_id_seq'), sgt.name, sgt.name,
+ 0, sgt.id, new_org_id
+ from rhnServerGroupType sgt
+ where sgt.label = 'sw_mgr_entitled';
+
+ org_id_out := new_org_id;
+
+ -- Returning the value of OUT parameter
+ return org_id_out;
+
+end;
+$$
+language plpgsql;
commit deaea577b74a7768c5adb77ba4c58c0218a09b06
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 14:00:16 2012 +0200
remove cert_admin from rhnUserGroupType table
diff --git a/schema/spacewalk/common/data/rhnUserGroupType.sql
b/schema/spacewalk/common/data/rhnUserGroupType.sql
index d34fb15..6992327 100644
--- a/schema/spacewalk/common/data/rhnUserGroupType.sql
+++ b/schema/spacewalk/common/data/rhnUserGroupType.sql
@@ -65,12 +65,6 @@ insert into rhnUserGroupType (id, label, name) values (
'Activation Key Administrator'
);
-insert into rhnUserGroupType (id, label, name) values (
- sequence_nextval('rhn_usergroup_type_seq'),
- 'cert_admin',
- 'Certificate Administrator'
-);
-
commit;
--
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/116-rhnUserGroupType_cert_admin.sql
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/116-rhnUserGroupType_cert_admin.sql
new file mode 100644
index 0000000..7c95605
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/116-rhnUserGroupType_cert_admin.sql
@@ -0,0 +1,5 @@
+DELETE FROM rhnUserGroupMembers WHERE user_group_id IN (SELECT g.id from rhnUserGroup g
JOIN rhnUserGroupType gt ON g.group_type = gt.id WHERE gt.label = 'cert_admin');
+
+DELETE FROM rhnUserGroup WHERE group_type IN (SELECT id FROM rhnUserGroupType WHERE label
= 'cert_admin');
+
+DELETE FROM rhnUserGroupType WHERE label = 'cert_admin';
commit bfc09d0b79a096fa32c7094c8534b2650ed71bc1
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 13:57:09 2012 +0200
remove usage of cert_admin user role
diff --git a/java/code/src/com/redhat/rhn/domain/org/OrgFactory.java
b/java/code/src/com/redhat/rhn/domain/org/OrgFactory.java
index 4da1469..b9bdc99 100644
--- a/java/code/src/com/redhat/rhn/domain/org/OrgFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/org/OrgFactory.java
@@ -181,7 +181,6 @@ public class OrgFactory extends HibernateFactory {
Org retval = lookupById((Long) row.get("org_id"));
retval.addRole(RoleFactory.ACTIVATION_KEY_ADMIN);
- retval.addRole(RoleFactory.CERT_ADMIN);
retval.addRole(RoleFactory.CHANNEL_ADMIN);
retval.addRole(RoleFactory.CONFIG_ADMIN);
retval.addRole(RoleFactory.SYSTEM_GROUP_ADMIN);
diff --git a/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
b/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
index c53a4a7..f0f7a3c 100644
--- a/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
@@ -110,9 +110,4 @@ public class RoleFactory extends HibernateFactory {
*/
public static final Role MONITORING_ADMIN =
lookupByLabel("monitoring_admin");
- /**
- * The constant representing cert_admin
- */
- public static final Role CERT_ADMIN = lookupByLabel("cert_admin");
-
}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/user/UserEditSetupAction.java
b/java/code/src/com/redhat/rhn/frontend/action/user/UserEditSetupAction.java
index ea90d55..4edf43d 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/user/UserEditSetupAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/user/UserEditSetupAction.java
@@ -139,9 +139,6 @@ public class UserEditSetupAction extends RhnAction {
StringBuffer disabledRoles = new StringBuffer();
for (Role currRole : orgRoles) {
- if (currRole.equals(RoleFactory.CERT_ADMIN)) {
- continue;
- }
log.debug("currRole = " + currRole.getLabel());
boolean selected = false; // does user have this role?
@@ -171,10 +168,6 @@ public class UserEditSetupAction extends RhnAction {
disabled = true;
log.debug("2");
}
- else if (targetUser.hasRole(RoleFactory.CERT_ADMIN)) {
- disabled = true;
- log.debug("3");
- }
//sat admin can not be modified outside sat tools
if (currRole.equals(RoleFactory.SAT_ADMIN)) {
commit f9a2c8faf35de0e9f5305d30a5325303a18fc613
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 13:46:47 2012 +0200
remove rhn_support from rhnUserGroupType table
diff --git a/schema/spacewalk/common/data/rhnUserGroupType.sql
b/schema/spacewalk/common/data/rhnUserGroupType.sql
index 3d85c6c..d34fb15 100644
--- a/schema/spacewalk/common/data/rhnUserGroupType.sql
+++ b/schema/spacewalk/common/data/rhnUserGroupType.sql
@@ -43,12 +43,6 @@ insert into rhnUserGroupType (id, label, name) values (
insert into rhnUserGroupType (id, label, name) values (
sequence_nextval('rhn_usergroup_type_seq'),
- 'rhn_support',
- 'Spacewalk Support Administrator'
-);
-
-insert into rhnUserGroupType (id, label, name) values (
- sequence_nextval('rhn_usergroup_type_seq'),
'config_admin',
'Configuration Administrator'
);
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/115-rhnUserGroupType_rhn_support.sql
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/115-rhnUserGroupType_rhn_support.sql
new file mode 100644
index 0000000..30dea71
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/115-rhnUserGroupType_rhn_support.sql
@@ -0,0 +1,5 @@
+DELETE FROM rhnUserGroupMembers WHERE user_group_id IN (SELECT g.id from rhnUserGroup g
JOIN rhnUserGroupType gt ON g.group_type = gt.id WHERE gt.label = 'rhn_support');
+
+DELETE FROM rhnUserGroup WHERE group_type IN (SELECT id FROM rhnUserGroupType WHERE label
= 'rhn_support');
+
+DELETE FROM rhnUserGroupType WHERE label = 'rhn_support';
commit e20640efc29b60c0a355026cfb2a48eea57b523f
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 13:46:17 2012 +0200
remove usage of rhn_support user role
diff --git a/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
b/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
index 80e3feb..c53a4a7 100644
--- a/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
@@ -91,11 +91,6 @@ public class RoleFactory extends HibernateFactory {
public static final Role CHANNEL_ADMIN = lookupByLabel("channel_admin");
/**
- * The constant representing rhn_support
- */
- public static final Role RHN_SUPPORT = lookupByLabel("rhn_support");
-
- /**
* The constant representing config_admin
*/
public static final Role CONFIG_ADMIN = lookupByLabel("config_admin");
diff --git a/java/code/src/com/redhat/rhn/frontend/action/user/UserEditSetupAction.java
b/java/code/src/com/redhat/rhn/frontend/action/user/UserEditSetupAction.java
index 4de8284..ea90d55 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/user/UserEditSetupAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/user/UserEditSetupAction.java
@@ -171,8 +171,7 @@ public class UserEditSetupAction extends RhnAction {
disabled = true;
log.debug("2");
}
- else if (currRole.equals(RoleFactory.RHN_SUPPORT) &&
- targetUser.hasRole(RoleFactory.CERT_ADMIN)) {
+ else if (targetUser.hasRole(RoleFactory.CERT_ADMIN)) {
disabled = true;
log.debug("3");
}
diff --git a/web/modules/rhn/RHN/Cleansers.pm b/web/modules/rhn/RHN/Cleansers.pm
index 0380cb1..cb53ee6 100644
--- a/web/modules/rhn/RHN/Cleansers.pm
+++ b/web/modules/rhn/RHN/Cleansers.pm
@@ -267,7 +267,6 @@ sub verify_support_var_access {
my @vars = grep { defined $_ } @_;
return 1 unless @vars;
- return 1 if $user->is('rhn_support');
return 0;
}
diff --git a/web/modules/rhn/RHN/DB/User.pm b/web/modules/rhn/RHN/DB/User.pm
index 826c2d6..29f4344 100644
--- a/web/modules/rhn/RHN/DB/User.pm
+++ b/web/modules/rhn/RHN/DB/User.pm
@@ -171,14 +171,6 @@ EOQ
}
}
- # the cert admin role implies rhn_support
- my $implied_cert_admin_role = 'rhn_support';
- if(exists $roles{cert_admin}) {
- if (grep { $implied_cert_admin_role eq $_ } $ret->org->available_roles) {
- $roles{$implied_cert_admin_role} = 1;
- }
- }
-
$ret->roles(keys %roles);
return $ret;
commit b14ad849e9721c63331e5c63fcfaf9518db14a58
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 11:44:44 2012 +0200
remove usage of unused org_applicant user role
diff --git a/java/code/src/com/redhat/rhn/domain/org/test/OrgFactoryTest.java
b/java/code/src/com/redhat/rhn/domain/org/test/OrgFactoryTest.java
index a31b9e6..91b3064 100644
--- a/java/code/src/com/redhat/rhn/domain/org/test/OrgFactoryTest.java
+++ b/java/code/src/com/redhat/rhn/domain/org/test/OrgFactoryTest.java
@@ -156,11 +156,6 @@ public class OrgFactoryTest extends RhnBaseTestCase {
assertNull(lookup.getToken());
}
- public void testHasRole() throws Exception {
- Org org1 = UserTestUtils.findNewOrg("testOrg");
- assertTrue(org1.hasRole(RoleFactory.ORG_APPLICANT));
- }
-
public void testImpliedEntitlement() throws Exception {
Org org1 = OrgFactory.createOrg();
assertTrue(org1
diff --git a/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
b/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
index f22c0e3..80e3feb 100644
--- a/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
@@ -85,12 +85,6 @@ public class RoleFactory extends HibernateFactory {
*/
public static final Role SAT_ADMIN = lookupByLabel("satellite_admin");
-
- /**
- * The constant representing org_applicant. Used for comparison.
- */
- public static final Role ORG_APPLICANT = lookupByLabel("org_applicant");
-
/**
* The constant representing channel_admin
*/
diff --git a/java/code/src/com/redhat/rhn/frontend/action/user/UserEditSetupAction.java
b/java/code/src/com/redhat/rhn/frontend/action/user/UserEditSetupAction.java
index 6873a2f..4de8284 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/user/UserEditSetupAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/user/UserEditSetupAction.java
@@ -139,8 +139,7 @@ public class UserEditSetupAction extends RhnAction {
StringBuffer disabledRoles = new StringBuffer();
for (Role currRole : orgRoles) {
- if (currRole.equals(RoleFactory.ORG_APPLICANT) ||
- currRole.equals(RoleFactory.CERT_ADMIN)) {
+ if (currRole.equals(RoleFactory.CERT_ADMIN)) {
continue;
}
log.debug("currRole = " + currRole.getLabel());
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/user/test/UserEditActionTest.java
b/java/code/src/com/redhat/rhn/frontend/action/user/test/UserEditActionTest.java
index 174d592..4a28021 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/user/test/UserEditActionTest.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/user/test/UserEditActionTest.java
@@ -145,8 +145,6 @@ public class UserEditActionTest extends RhnBaseTestCase {
(String)null);
request.setupAddParameter("role_" + RoleFactory.ORG_ADMIN.getLabel(),
(String)null);
- request.setupAddParameter("role_" +
RoleFactory.ORG_APPLICANT.getLabel(),
- (String)null);
request.setupAddParameter("role_" +
RoleFactory.CHANNEL_ADMIN.getLabel(),
(String)null);
request.setupAddParameter("role_" + RoleFactory.SAT_ADMIN.getLabel(),
commit 1a15fcb4ff4e386d199f280bc00cf61a142db648
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 11:33:43 2012 +0200
remove rhn_superuser from rhnUserGroupType table
diff --git a/schema/spacewalk/common/data/rhnUserGroupType.sql
b/schema/spacewalk/common/data/rhnUserGroupType.sql
index 6142892..3d85c6c 100644
--- a/schema/spacewalk/common/data/rhnUserGroupType.sql
+++ b/schema/spacewalk/common/data/rhnUserGroupType.sql
@@ -49,12 +49,6 @@ insert into rhnUserGroupType (id, label, name) values (
insert into rhnUserGroupType (id, label, name) values (
sequence_nextval('rhn_usergroup_type_seq'),
- 'rhn_superuser',
- 'Spacewalk Superuser'
-);
-
-insert into rhnUserGroupType (id, label, name) values (
- sequence_nextval('rhn_usergroup_type_seq'),
'config_admin',
'Configuration Administrator'
);
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/114-rhnUserGroupType_rhn_superuser.sql
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/114-rhnUserGroupType_rhn_superuser.sql
new file mode 100644
index 0000000..58c602e
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/114-rhnUserGroupType_rhn_superuser.sql
@@ -0,0 +1,5 @@
+DELETE FROM rhnUserGroupMembers WHERE user_group_id IN (SELECT g.id from rhnUserGroup g
JOIN rhnUserGroupType gt ON g.group_type = gt.id WHERE gt.label =
'rhn_superuser');
+
+DELETE FROM rhnUserGroup WHERE group_type IN (SELECT id FROM rhnUserGroupType WHERE label
= 'rhn_superuser');
+
+DELETE FROM rhnUserGroupType WHERE label = 'rhn_superuser';
commit a813b8f161234062ed0fb4f46abf760616473c90
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 11:29:33 2012 +0200
remove rhn_superuser occurences in java translation strings
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_bn_IN.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_bn_IN.xml
index 46022bb..c562798 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_bn_IN.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_bn_IN.xml
@@ -2145,12 +2145,6 @@ available for this kickstart profile to function properly.
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>চ্যানেলের অ্যাডমিনিস্ট্রেটর</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>@@PRODUCT_NAME@@ সুপার-ইউজার</target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_de.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_de.xml
index dfbbcb8..62c107b 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_de.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_de.xml
@@ -2170,12 +2170,6 @@ verfügbar machen, damit dieses Kickstart-Profil einwandfrei
funktionieren kann.
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>Channel-Administrator</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>@@PRODUCT_NAME@@ Superuser</target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index 02c2985..9fd6b05 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -2222,12 +2222,6 @@ available for this kickstart profile to function properly.
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
</trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- </trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_es.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_es.xml
index 1ad93ec..abcdf9d 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_es.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_es.xml
@@ -2164,12 +2164,6 @@ asegurarse de que estén disponibles para que este perfil kickstart
funcione apr
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>Administrador del canal</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>Superusuario de @@PRODUCT_NAME@@</target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_fr.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_fr.xml
index e9317b7..bd251c4 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_fr.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_fr.xml
@@ -2166,12 +2166,6 @@ disponibles pour que ce profil kickstart puisse fonctionner
correctement.
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>Administrateur de canaux</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>Super-utilisateur @@PRODUCT_NAME@@
</target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_gu.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_gu.xml
index 049d972..eba216b 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_gu.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_gu.xml
@@ -2139,12 +2139,6 @@ available for this kickstart profile to function properly.
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>ચેનલ સંચાલક</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>@@PRODUCT_NAME@@ શ્રેષ્ટ
વપરાશકર્તા</target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_hi.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_hi.xml
index 5c3e368..beddf59 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_hi.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_hi.xml
@@ -2139,12 +2139,6 @@ available for this kickstart profile to function properly.
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>चैनल प्रशासक</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>@@PRODUCT_NAME@@ सुपरयूजर</target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_it.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_it.xml
index f18ce30..65c0160 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_it.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_it.xml
@@ -2163,12 +2163,6 @@ disponibili per un corretto funzionamento di questo profilo
kickstart.
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>Amministratore del canale</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>Super utente @@PRODUCT_NAME@@</target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ja.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ja.xml
index d18c3a8..4265dd8 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ja.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ja.xml
@@ -2163,12 +2163,6 @@ rhn-kickstart* パッケージが利用可能であることを確認します
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>チャンネル管理者</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>@@PRODUCT_NAME@@ スーパーユーザー </target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ko.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ko.xml
index 469c544..4d61e29 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ko.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ko.xml
@@ -2139,12 +2139,6 @@ available for this kickstart profile to function properly.
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>채널 관리자</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>@@PRODUCT_NAME@@ 수퍼 유저 </target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_pa.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_pa.xml
index 0b67f10..9afc5b4 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_pa.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_pa.xml
@@ -2141,12 +2141,6 @@ available for this kickstart profile to function properly.
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>ਚੈਨਲ ਪਰਬੰਧਕ</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>@@PRODUCT_NAME@@ ਸੁਪਰਯੂਜ਼ਰ</target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_pt_BR.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_pt_BR.xml
index 4d37cba..9c96795 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_pt_BR.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_pt_BR.xml
@@ -2153,12 +2153,6 @@ disponíveis para seu perfil kickstart funcionar
corretamente./n</li>
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>Administrador do Canal</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>Super usuário do @@PRODUCT_NAME@@</target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ru.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ru.xml
index b3cbd48..3349644 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ru.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ru.xml
@@ -2139,12 +2139,6 @@ available for this kickstart profile to function properly.
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>Администратор канала</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>Супер-пользователь
@@PRODUCT_NAME@@</target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ta.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ta.xml
index f4c0c64..1ac3076 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ta.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_ta.xml
@@ -2139,12 +2139,6 @@ available for this kickstart profile to function properly.
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>தட நிர்வாகி</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>@@PRODUCT_NAME@@ சூப்பர்பயனர்</target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_zh_CN.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_zh_CN.xml
index e0afac7..d58a798 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_zh_CN.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_zh_CN.xml
@@ -2164,12 +2164,6 @@ available for this kickstart profile to function properly.
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>频道管理员</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>@@PRODUCT_NAME@@ 超级用户</target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_zh_TW.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_zh_TW.xml
index 4f88e5c..53a7c06 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_zh_TW.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_zh_TW.xml
@@ -2139,12 +2139,6 @@ available for this kickstart profile to function properly.
<context
context-type="sourcefile">/rhn/account/UserDetails</context>
</context-group>
<target>頻道管理員</target></trans-unit>
- <trans-unit id="rhn_superuser">
-<source>@@PRODUCT_NAME@@ Superuser</source>
- <context-group name="ctx">
- <context
context-type="sourcefile">/rhn/account/UserDetails</context>
- </context-group>
- <target>@@PRODUCT_NAME@@ 超級用戶</target></trans-unit>
<trans-unit id="coma_admin">
<source>Coma CMS Administrator</source>
<context-group name="ctx">
commit bcd4b2ff3d5dff86a7f69a39691c33059266efb8
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Jul 27 11:29:03 2012 +0200
remove usage of rhn_superuser user role
diff --git a/backend/server/importlib/userAuth.py b/backend/server/importlib/userAuth.py
index 2affccc..eef6eec 100644
--- a/backend/server/importlib/userAuth.py
+++ b/backend/server/importlib/userAuth.py
@@ -58,18 +58,7 @@ class UserAuth:
log_debug(4, "Groups: %s; org_id: %s; user_id: %s" % (
self.groups, self.org_id, self.user_id))
- def isSuperuser(self):
- if 'rhn_superuser' in self.groups:
- log_debug(4, "Is superuser")
- return 1
- log_debug(4, "Is NOT superuser")
- return 0
-
def isOrgAdmin(self):
- if self.isSuperuser():
- log_debug(4, "Is org admin because isa superuser")
- # Superusers can do anything
- return 1
if 'org_admin' in self.groups:
log_debug(4, "Is org admin")
return 1
@@ -77,10 +66,6 @@ class UserAuth:
return 0
def isChannelAdmin(self):
- if self.isSuperuser():
- # Superusers can do anything
- log_debug(4, "Is channel admin because isa superuser")
- return 1
if 'org_admin' in self.groups:
log_debug(4, "Is channel admin because isa org admin")
return 1
@@ -135,9 +120,6 @@ class UserAuth:
log_debug(4, channels)
if not channels:
return
- if 'rhn_superuser' in self.groups:
- log_debug(4, "Is superuser")
- return None
# rhn_channel.user_role_check checks for the ownership of the channel
# by this user's org
diff --git a/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
b/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
index 2558a92..f22c0e3 100644
--- a/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/role/RoleFactory.java
@@ -97,11 +97,6 @@ public class RoleFactory extends HibernateFactory {
public static final Role CHANNEL_ADMIN = lookupByLabel("channel_admin");
/**
- * The constant representing rhn_superuser
- */
- public static final Role RHN_SUPERUSER = lookupByLabel("rhn_superuser");
-
- /**
* The constant representing rhn_support
*/
public static final Role RHN_SUPPORT = lookupByLabel("rhn_support");
diff --git a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
index 05495d3..3f99394 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
@@ -930,8 +930,7 @@ public class ChannelManager extends BaseManager {
public static boolean verifyChannelAdmin(User user, Long cid)
throws InvalidChannelRoleException {
- if (user.hasRole(RoleFactory.RHN_SUPERUSER) ||
- user.hasRole(RoleFactory.CHANNEL_ADMIN)) {
+ if (user.hasRole(RoleFactory.CHANNEL_ADMIN)) {
return true;
}
@@ -1023,10 +1022,6 @@ public class ChannelManager extends BaseManager {
*/
public static boolean verifyChannelSubscribe(User user, Long cid) {
- if (user.hasRole(RoleFactory.RHN_SUPERUSER)) {
- return true;
- }
-
try {
return verifyChannelRole(user, cid, QRY_ROLE_SUBSCRIBE);
}
@@ -1055,10 +1050,6 @@ public class ChannelManager extends BaseManager {
*/
public static boolean verifyChannelManage(User user, Long cid) {
- if (user.hasRole(RoleFactory.RHN_SUPERUSER)) {
- return true;
- }
-
try {
return verifyChannelRole(user, cid, QRY_ROLE_MANAGE);
}
diff --git a/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
b/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
index dea5fa9..e9b0b23 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
@@ -18,7 +18,6 @@ import com.redhat.rhn.domain.channel.Channel;
import com.redhat.rhn.domain.channel.ChannelArch;
import com.redhat.rhn.domain.channel.ChannelFactory;
import com.redhat.rhn.domain.common.ChecksumType;
-import com.redhat.rhn.domain.role.RoleFactory;
import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.frontend.xmlrpc.InvalidChannelLabelException;
import com.redhat.rhn.frontend.xmlrpc.InvalidChannelNameException;
@@ -375,8 +374,7 @@ public class CreateChannelCommand {
// the perl code used to ignore case with a /i at the end of
// the regex, so we toLowerCase() the channel name to make it
// work the same.
- if (!user.hasRole(RoleFactory.RHN_SUPERUSER) &&
- Pattern.compile(REDHAT_REGEX).matcher(cname.toLowerCase()).find()) {
+ if (Pattern.compile(REDHAT_REGEX).matcher(cname.toLowerCase()).find()) {
throw new InvalidChannelNameException(cname,
InvalidChannelNameException.Reason.RHN_CHANNEL_BAD_PERMISSIONS,
"edit.channel.invalidchannelname.redhat", "");
@@ -413,8 +411,7 @@ public class CreateChannelCommand {
// the perl code used to ignore case with a /i at the end of
// the regex, so we toLowerCase() the channel name to make it
// work the same.
- if (!user.hasRole(RoleFactory.RHN_SUPERUSER) &&
- Pattern.compile(REDHAT_REGEX).matcher(clabel.toLowerCase()).find()) {
+ if (Pattern.compile(REDHAT_REGEX).matcher(clabel.toLowerCase()).find()) {
throw new InvalidChannelLabelException(clabel,
InvalidChannelLabelException.Reason.RHN_CHANNEL_BAD_PERMISSIONS,
"edit.channel.invalidchannellabel.redhat", "");
diff --git a/java/code/src/com/redhat/rhn/manager/channel/test/CreateCommandTest.java
b/java/code/src/com/redhat/rhn/manager/channel/test/CreateCommandTest.java
index eeef556..d289b86 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/test/CreateCommandTest.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/test/CreateCommandTest.java
@@ -15,7 +15,6 @@
package com.redhat.rhn.manager.channel.test;
import com.redhat.rhn.domain.channel.Channel;
-import com.redhat.rhn.domain.role.RoleFactory;
import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.frontend.xmlrpc.InvalidChannelLabelException;
import com.redhat.rhn.frontend.xmlrpc.InvalidChannelNameException;
@@ -60,7 +59,6 @@ public class CreateCommandTest extends RhnBaseTestCase {
invalidChannelName(null);
invalidChannelName("_123456");
// test rhn or red hat channels
- assertFalse(user.hasRole(RoleFactory.RHN_SUPERUSER));
invalidChannelName("rhn-channel-name");
invalidChannelName("redhat linux");
invalidChannelName("Red Hat Enterprise Spacewalk Sync");
@@ -152,7 +150,6 @@ public class CreateCommandTest extends RhnBaseTestCase {
invalidChannelLabel("------");
invalidChannelLabel("______");
// test rhn or red hat channels
- assertFalse(user.hasRole(RoleFactory.RHN_SUPERUSER));
invalidChannelLabel("rhn-channel-name");
invalidChannelLabel("redhat linux");
invalidChannelLabel("Red Hat Enterprise Spacewalk Sync");
diff --git a/web/modules/rhn/RHN/DB/User.pm b/web/modules/rhn/RHN/DB/User.pm
index dbc90c0..826c2d6 100644
--- a/web/modules/rhn/RHN/DB/User.pm
+++ b/web/modules/rhn/RHN/DB/User.pm
@@ -801,8 +801,6 @@ sub verify_channel_subscribe {
my $self = shift;
my @channel_ids = @_;
- return 1 if $self->is('rhn_superuser');
-
for my $cid (@channel_ids) {
return 0 unless $self->verify_channel_role($cid, 'subscribe');
}
@@ -1063,8 +1061,6 @@ sub verify_user_admin {
my $self = shift;
my @user_ids = @_;
- return 1 if $self->is('rhn_superuser');
-
my $dbh = RHN::DB->connect;
my $sth = $dbh->prepare("SELECT org_id FROM web_contact WHERE id = ?");
@@ -1104,8 +1100,6 @@ sub verify_system_group_user_admin {
my $self = shift;
my @user_ids = @_;
- return 1 if $self->is('rhn_superuser');
-
my $dbh = RHN::DB->connect;
my $sth = $dbh->prepare("SELECT org_id FROM web_contact WHERE id = ?");
@@ -1131,8 +1125,6 @@ sub verify_channel_admin {
my $self = shift;
my @channel_ids = @_;
- return 1 if $self->is('rhn_superuser');
-
for my $cid (@channel_ids) {
next unless $cid;
return 0 unless $self->verify_channel_role($cid, 'manage');
@@ -1162,8 +1154,6 @@ sub verify_errata_admin {
my $self = shift;
my @errata_ids = @_;
- return 1 if $self->is('rhn_superuser');
-
my $dbh = RHN::DB->connect;
my $sth = $dbh->prepare(<<EOQ);
SELECT 1 FROM rhnErrata E
diff --git a/web/modules/sniglets/Sniglets/ChannelEditor.pm
b/web/modules/sniglets/Sniglets/ChannelEditor.pm
index 8b0e9b7..3b9e14a 100644
--- a/web/modules/sniglets/Sniglets/ChannelEditor.pm
+++ b/web/modules/sniglets/Sniglets/ChannelEditor.pm
@@ -132,16 +132,14 @@ sub channel_edit_cb {
my $errors = 0;
- unless ($pxt->user->is('rhn_superuser')) {
- if ($channel_name =~ /^(rhn|red\s*hat)/i) {
- $pxt->push_message(local_alert => "Channel name cannot begin with
'<strong>$1</strong>'");
- $errors++;
- }
+ if ($channel_name =~ /^(rhn|red\s*hat)/i) {
+ $pxt->push_message(local_alert => "Channel name cannot begin with
'<strong>$1</strong>'");
+ $errors++;
+ }
- if ($channel_label =~ /^(rhn|red\s*hat)/i) {
- $pxt->push_message(local_alert => "Channel label cannot begin with
'<strong>$1</strong>'");
- $errors++;
- }
+ if ($channel_label =~ /^(rhn|red\s*hat)/i) {
+ $pxt->push_message(local_alert => "Channel label cannot begin with
'<strong>$1</strong>'");
+ $errors++;
}
# bugzilla: 161517 - allow _ and / in channel labels
# bugzilla: 459827 - disallow names longer than 64 characters
diff --git a/web/modules/sniglets/Sniglets/Users.pm
b/web/modules/sniglets/Sniglets/Users.pm
index 2b7211f..7b4400c 100644
--- a/web/modules/sniglets/Sniglets/Users.pm
+++ b/web/modules/sniglets/Sniglets/Users.pm
@@ -359,7 +359,7 @@ sub check_perms {
}
#role - property of a user - currently channel_admin, coma_admin,
- #coma_author, coma_publisher, org_admin, org_applicant, or rhn_superuser.
+ #coma_author, coma_publisher, org_admin, org_applicant.
if ($params{role}) {
if ($params{role} =~ /^!(.*)$/) {
return if $pxt->user->is($1);