Main Tables Views Materialized Views Indexes Constraints Triggers Procedures Functions Packages Sequences Java Sources 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: 		oracle_customer_id, oracle_customer_number,
    18: 		customer_type
    19: 	) values (
    20: 		new_org_id, name_in,
    21: 		new_org_id, new_org_id, 'B'
    22: 	);
    23: 
    24: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    25: 
    26: 	select	id
    27: 	into	ug_type
    28: 	from	rhnUserGroupType
    29: 	where	label = 'org_admin';
    30: 
    31: 	insert into rhnUserGroup (
    32: 		id, name,
    33: 		description,
    34: 		max_members, group_type, org_id
    35: 	) values (
    36: 		group_val, 'Organization Administrators',
    37: 		'Organization Administrators for Org ' || name_in,
    38: 		NULL, ug_type, new_org_id
    39: 	);
    40: 
    41: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    42: 
    43: 	select	id
    44: 	into	ug_type
    45: 	from	rhnUserGroupType
    46: 	where	label = 'org_applicant';
    47: 
    48: 	insert into rhnUserGroup (
    49: 		id, name,
    50: 		description,
    51: 		max_members, group_type, org_id
    52: 	) VALues (
    53: 		group_val, 'Organization Applicants',
    54: 		'Organization Applicants for Org ' || name_in,
    55: 		NULL, ug_type, new_org_id
    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 = 'system_group_admin';
    64: 
    65: 	insert into rhnUserGroup (
    66: 		id, name,
    67: 		description,
    68: 		max_members, group_type, org_id
    69: 	) values (
    70: 		group_val, 'System Group Administrators',
    71: 		'System Group Administrators for Org ' || name_in,
    72: 		NULL, ug_type, new_org_id
    73: 	);
    74: 
    75: 
    76: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    77: 
    78: 	select	id
    79: 	into	ug_type
    80: 	from	rhnUserGroupType
    81: 	where	label = 'activation_key_admin';
    82: 
    83: 	insert into rhnUserGroup (
    84: 		id, name,
    85: 		description,
    86: 		max_members, group_type, org_id
    87: 	) values (
    88: 		group_val, 'Activation Key Administrators',
    89: 		'Activation Key Administrators for Org ' || name_in,
    90: 		NULL, ug_type, new_org_id
    91: 	);
    92: 
    93: 	-- config admin is special; it gets created in
    94: 	-- rhn_entitlements.set_customer_provisioning instead.
    95: 
    96: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    97: 
    98: 	select	id
    99: 	into	ug_type
   100: 	from	rhnUserGroupType
   101: 	where	label = 'channel_admin';
   102: 
   103: 	insert into rhnUserGroup (
   104: 		id, name,
   105: 		description,
   106: 		max_members, group_type, org_id
   107: 	) values (
   108: 		group_val, 'Channel Administrators',
   109: 		'Channel Administrators for Org ' || name_in,
   110: 		NULL, ug_type, new_org_id
   111: 	);
   112: 
   113: 	-- there aren't any users yet, so we don't need to update
   114: 	-- rhnUserServerPerms
   115:         insert into rhnServerGroup
   116: 		( id, name, description, max_members, group_type, org_id )
   117: 		select rhn_server_group_id_seq.nextval, sgt.name, sgt.name,
   118: 			0, sgt.id, new_org_id
   119: 		from rhnServerGroupType sgt
   120: 		where sgt.label = 'sw_mgr_entitled';
   121: 
   122: 	org_id_out := new_org_id;
   123: 
   124: end create_new_org;