Main Tables Views Materialized Views Indexes Constraints Triggers Procedures Functions Packages Sequences Java Sources Jobs Sanity Check Index DDL scrips
Arguments Source

CREATE_NEW_ORG

Arguments:

NameData TypeDefault ValueIn/Out
NAME_INVARCHAR2 IN
PASSWORD_INVARCHAR2 IN
ORG_ID_OUTNUMBER(38) OUT
DDL script

Source

Legend: comment string keyword reserved word operator
     1: procedure
     2: create_new_org
     3: (
     4: 	name_in      in varchar2,
     5: 	password_in  in varchar2,
     6: 	org_id_out   out number
     7: ) is
     8: 	ug_type			number;
     9: 	group_val		number;
    10: 	new_org_id              number;
    11: begin
    12: 
    13:         select web_customer_id_seq.nextval into new_org_id from dual;
    14: 
    15: 	insert into web_customer (
    16: 		id, name
    17: 
    18: 
    19: 	) values (
    20: 		new_org_id, name_in
    21: 	);
    22: 
    23: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    24: 
    25: 	select	id
    26: 	into	ug_type
    27: 	from	rhnUserGroupType
    28: 	where	label = 'org_admin';
    29: 
    30: 	insert into rhnUserGroup (
    31: 		id, name,
    32: 		description,
    33: 		max_members, group_type, org_id
    34: 	) values (
    35: 		group_val, 'Organization Administrators',
    36: 		'Organization Administrators for Org ' || name_in,
    37: 		NULL, ug_type, new_org_id
    38: 	);
    39: 
    40: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    41: 
    42: 	select	id
    43: 	into	ug_type
    44: 	from	rhnUserGroupType
    45: 	where	label = 'system_group_admin';
    46: 
    47: 	insert into rhnUserGroup (
    48: 		id, name,
    49: 		description,
    50: 		max_members, group_type, org_id
    51: 	) values (
    52: 		group_val, 'System Group Administrators',
    53: 		'System Group Administrators for Org ' || name_in,
    54: 		NULL, ug_type, new_org_id
    55: 	);
    56: 
    57: 
    58: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    59: 
    60: 	select	id
    61: 	into	ug_type
    62: 	from	rhnUserGroupType
    63: 	where	label = 'activation_key_admin';
    64: 
    65: 	insert into rhnUserGroup (
    66: 		id, name,
    67: 		description,
    68: 		max_members, group_type, org_id
    69: 	) values (
    70: 		group_val, 'Activation Key Administrators',
    71: 		'Activation Key Administrators for Org ' || name_in,
    72: 		NULL, ug_type, new_org_id
    73: 	);
    74: 
    75: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    76: 
    77: 	select	id
    78: 	into	ug_type
    79: 	from	rhnUserGroupType
    80: 	where	label = 'channel_admin';
    81: 
    82: 	insert into rhnUserGroup (
    83: 		id, name,
    84: 		description,
    85: 		max_members, group_type, org_id
    86: 	) values (
    87: 		group_val, 'Channel Administrators',
    88: 		'Channel Administrators for Org ' || name_in,
    89: 		NULL, ug_type, new_org_id
    90: 	);
    91: 
    92:         select rhn_user_group_id_seq.nextval into group_val from dual;
    93: 
    94:         select  id
    95:         into    ug_type
    96:         from    rhnUserGroupType
    97:         where   label = 'config_admin';
    98: 
    99:         insert into rhnUserGroup (
   100:                 id, name,
   101:                 description,
   102:                 max_members, group_type, org_id
   103:         ) values (
   104:                 group_val, 'Configuration Administrators',
   105:                 'Configuration Administrators for Org ' || name_in,
   106:                 NULL, ug_type, new_org_id
   107:         );
   108: 
   109: 	-- there aren't any users yet, so we don't need to update
   110: 	-- rhnUserServerPerms
   111: 
   112:         insert into rhnServerGroup
   113:                 ( id, name, description, group_type, org_id )
   114:                 select rhn_server_group_id_seq.nextval, sgt.name, sgt.name,
   115:                         sgt.id, new_org_id
   116:                 from rhnServerGroupType sgt
   117:                 where sgt.label = 'bootstrap_entitled';
   118: 
   119:         insert into rhnServerGroup
   120:                 ( id, name, description, group_type, org_id )
   121:                 select rhn_server_group_id_seq.nextval, sgt.name, sgt.name,
   122:                         sgt.id, new_org_id
   123:                 from rhnServerGroupType sgt
   124:                 where sgt.label = 'enterprise_entitled';
   125: 
   126:         insert into rhnServerGroup
   127:                 ( id, name, description, group_type, org_id )
   128:                 select rhn_server_group_id_seq.nextval, sgt.name, sgt.name,
   129:                         sgt.id, new_org_id
   130:                 from rhnServerGroupType sgt
   131:                 where sgt.label = 'virtualization_host';
   132: 
   133: 	org_id_out := new_org_id;
   134: 
   135: end create_new_org;