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:         select web_customer_id_seq.nextval into new_org_id from dual;
    13: 	insert into web_customer (
    14: 		id, name, password,
    15: 		oracle_customer_id, oracle_customer_number,
    16: 		customer_type
    17: 	) values (
    18: 		new_org_id, name_in, password_in,
    19: 		new_org_id, new_org_id, 'B'
    20: 	);
    21: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    22: 	select	id
    23: 	into	ug_type
    24: 	from	rhnUserGroupType
    25: 	where	label = 'org_admin';
    26: 	insert into rhnUserGroup (
    27: 		id, name,
    28: 		description,
    29: 		max_members, group_type, org_id
    30: 	) values (
    31: 		group_val, 'Organization Administrators',
    32: 		'Organization Administrators for Org ' || name_in,
    33: 		NULL, ug_type, new_org_id
    34: 	);
    35: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    36: 	select	id
    37: 	into	ug_type
    38: 	from	rhnUserGroupType
    39: 	where	label = 'org_applicant';
    40: 	insert into rhnUserGroup (
    41: 		id, name,
    42: 		description,
    43: 		max_members, group_type, org_id
    44: 	) VALues (
    45: 		group_val, 'Organization Applicants',
    46: 		'Organization Applicants for Org ' || name_in,
    47: 		NULL, ug_type, new_org_id
    48: 	);
    49: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    50: 	select	id
    51: 	into	ug_type
    52: 	from	rhnUserGroupType
    53: 	where	label = 'system_group_admin';
    54: 	insert into rhnUserGroup (
    55: 		id, name,
    56: 		description,
    57: 		max_members, group_type, org_id
    58: 	) values (
    59: 		group_val, 'System Group Administrators',
    60: 		'System Group Administrators for Org ' || name_in,
    61: 		NULL, ug_type, new_org_id
    62: 	);
    63: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    64: 	select	id
    65: 	into	ug_type
    66: 	from	rhnUserGroupType
    67: 	where	label = 'activation_key_admin';
    68: 	insert into rhnUserGroup (
    69: 		id, name,
    70: 		description,
    71: 		max_members, group_type, org_id
    72: 	) values (
    73: 		group_val, 'Activation Key Administrators',
    74: 		'Activation Key Administrators for Org ' || name_in,
    75: 		NULL, ug_type, new_org_id
    76: 	);
    77: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    78: 	select	id
    79: 	into	ug_type
    80: 	from	rhnUserGroupType
    81: 	where	label = 'channel_admin';
    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:         insert into rhnServerGroup
    92: 		( id, name, description, max_members, group_type, org_id )
    93: 		select rhn_server_group_id_seq.nextval, sgt.name, sgt.name,
    94: 			0, sgt.id, new_org_id
    95: 		from rhnServerGroupType sgt
    96: 		where sgt.label = 'sw_mgr_entitled';
    97: 	org_id_out := new_org_id;
    98: end create_new_org;