How to recover the deleted 'crowd-administrators' group
Purpose
There is a bug that allows the 'crowd-administrators' group to be deleted. Afterward, administrators will no longer have access to Crowd. This How-To article tells you how to recover when it is mistakenly deleted.
The bug is reported in CWD-1661 - Able to delete "Crowd-Administrators" and not access Crowd anymore.
Solution
Recreate 'crowd-administrators' group
insert into cwd_group(id, group_name, lower_group_name, active, is_local, created_date, updated_date, description, group_type, directory_id) values ( '888888','crowd-administrators','crowd-administrators','T','F','2015-09-25 12:20:29','2015-09-25 12:20:29',NULL,'GROUP',(select id from cwd_directory where directory_type='INTERNAL'));
Find the ID of users who will join 'crowd-administrators' group
select * from cwd_user;
Recreate group memberships, replacing <id from step 2> in the code. You need to execute the SQL query multiple time according to the number of users you want to join to 'crowd-administrators' group
insert into cwd_membership (id, parent_id, child_id, membership_type, group_type, parent_name, lower_parent_name, child_name, lower_child_name, directory_id) values (777777, (select id from cwd_group where group_name='crowd-administrators' and directory_id=(select id from cwd_directory where directory_type='INTERNAL')), <id from step 2>, 'GROUP_USER', 'GROUP', 'crowd-administrators', 'crowd-administrators', <user_name from step 2>, <lower_user_name from step 2>, (select id from cwd_directory where directory_type='INTERNAL'));
Find the directory-to-application mapping
select m.id, m.application_id, m.directory_id from cwd_app_dir_mapping m join cwd_directory d on m.directory_id = d.id join cwd_application a on m.application_id = a.id where d.directory_type='INTERNAL' and a.application_type = 'CROWD';
Give the group access to the application, replacing <id from Step 4>, <application_id from Step 4>, and <directory_id from Step 4>
insert into cwd_app_dir_group_mapping (id, app_dir_mapping_id, application_id, directory_id, group_name) values (898990, <id from Step 4>, <application_id from Step 4>, <directory_id from Step 4>, 'crowd-administrators');
Enable System Administrator flag for 'crowd-administrators'
insert into cwd_granted_perm (id, created_date, permission_id, app_dir_mapping_id, group_name) values ('999999', '2015-09-25 12:20:29', 2, <id from Step 4>, 'crowd-administrators');