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

CREATE_FIRST_ORG

Arguments:

NameData TypeDefault ValueIn/Out
NAME_INVARCHAR2 IN
PASSWORD_INVARCHAR2 IN
DDL script

Source

Legend: comment string keyword reserved word operator
     1: procedure
     2: create_first_org
     3: (
     4: 	name_in in varchar2,
     5: 	password_in in varchar2
     6: ) is
     7: 	ug_type			number;
     8: 	group_val		number;
     9: begin
    10: 	insert into web_customer (
    11: 		id, name,
    12: 		oracle_customer_id, oracle_customer_number,
    13: 		customer_type
    14: 	) values (
    15: 		1, name_in,
    16: 		1, 1, 'B'
    17: 	);
    18: 
    19: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    20: 
    21: 	select	id
    22: 	into	ug_type
    23: 	from	rhnUserGroupType
    24: 	where	label = 'org_admin';
    25: 
    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 || ' (1)',
    33: 		NULL, ug_type, 1
    34: 	);
    35: 
    36: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    37: 
    38: 	select	id
    39: 	into	ug_type
    40: 	from	rhnUserGroupType
    41: 	where	label = 'org_applicant';
    42: 
    43: 	insert into rhnUserGroup (
    44: 		id, name,
    45: 		description,
    46: 		max_members, group_type, org_id
    47: 	) VALues (
    48: 		group_val, 'Organization Applicants',
    49: 		'Organization Applicants for Org ' || name_in || ' (1)',
    50: 		NULL, ug_type, 1
    51: 	);
    52: 
    53: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    54: 
    55: 	select	id
    56: 	into	ug_type
    57: 	from	rhnUserGroupType
    58: 	where	label = 'system_group_admin';
    59: 
    60: 	insert into rhnUserGroup (
    61: 		id, name,
    62: 		description,
    63: 		max_members, group_type, org_id
    64: 	) values (
    65: 		group_val, 'System Group Administrators',
    66: 		'System Group Administrators for Org ' || name_in || ' (1)',
    67: 		NULL, ug_type, 1
    68: 	);
    69: 
    70: 
    71: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    72: 
    73: 	select	id
    74: 	into	ug_type
    75: 	from	rhnUserGroupType
    76: 	where	label = 'activation_key_admin';
    77: 
    78: 	insert into rhnUserGroup (
    79: 		id, name,
    80: 		description,
    81: 		max_members, group_type, org_id
    82: 	) values (
    83: 		group_val, 'Activation Key Administrators',
    84: 		'Activation Key Administrators for Org ' || name_in || ' (1)',
    85: 		NULL, ug_type, 1
    86: 	);
    87: 
    88: 	-- config admin is special; it gets created in
    89: 	-- rhn_entitlements.set_customer_provisioning instead.
    90: 
    91: 	select rhn_user_group_id_seq.nextval into group_val from dual;
    92: 
    93: 	select	id
    94: 	into	ug_type
    95: 	from	rhnUserGroupType
    96: 	where	label = 'channel_admin';
    97: 
    98: 	insert into rhnUserGroup (
    99: 		id, name,
   100: 		description,
   101: 		max_members, group_type, org_id
   102: 	) values (
   103: 		group_val, 'Channel Administrators',
   104: 		'Channel Administrators for Org ' || name_in || ' (1)',
   105: 		NULL, ug_type, 1
   106: 	);
   107: 
   108: 	select rhn_user_group_id_seq.nextval into group_val from dual;
   109: 
   110: 	select	id
   111: 	into	ug_type
   112: 	from	rhnUserGroupType
   113: 	where	label = 'satellite_admin';
   114: 
   115: 	insert into rhnUserGroup (
   116: 		id, name,
   117: 		description,
   118: 		max_members, group_type, org_id
   119: 	) values (
   120: 		group_val, 'Satellite Administrators',
   121: 		'Satellite Administrators for Org ' || name_in || ' (1)',
   122: 		NULL, ug_type, 1
   123: 	);
   124: 
   125: 
   126: 	-- if they need more than 16GB, they'll call us and we'll whip
   127: 	-- out a "can be null" patch, which we should do for next
   128: 	-- version anyway.  (I thought we did that for this version?)
   129: 	insert into rhnOrgQuota(
   130: 		org_id, total
   131: 	) values (
   132: 		1, 1024*1024*1024*16
   133: 	);
   134: 
   135: 
   136: 	-- there aren't any users yet, so we don't need to update
   137: 	-- rhnUserServerPerms
   138:         insert into rhnServerGroup
   139: 		( id, name, description, max_members, group_type, org_id )
   140: 		select rhn_server_group_id_seq.nextval, sgt.name, sgt.name,
   141: 			0, sgt.id, 1
   142: 		from rhnServerGroupType sgt
   143: 		where sgt.label = 'sw_mgr_entitled';
   144: 
   145: end create_first_org;