}
}
try {
AuthorizationManager ac = systemRegistry.getUserRealm().getAuthorizationManager();
RealmConfiguration realmConfig;
realmConfig = registryContext.getRealmService().getBootstrapRealmConfiguration();
String systemUserName = CarbonConstants.REGISTRY_SYSTEM_USERNAME;
ac.clearResourceAuthorizations("/system");
ac.authorizeUser(systemUserName, "/system", ActionConstants.GET);
ac.authorizeUser(systemUserName, "/system", ActionConstants.PUT);
ac.authorizeUser(systemUserName, "/system", ActionConstants.DELETE);
ac.authorizeUser(systemUserName, "/system", AccessControlConstants.AUTHORIZE);
String adminUserName = CarbonConstants.REGISTRY_SYSTEM_USERNAME;
ac.authorizeUser(adminUserName, "/system", ActionConstants.GET);
String adminRoleName = realmConfig.getAdminRoleName();
ac.authorizeRole(adminRoleName, "/system", ActionConstants.GET);
// any user should be able to execute auto generated queries, though the results
// of such queries are filtered to match current users permission level.
String everyoneRoleName = realmConfig.getEveryOneRoleName();
ac.authorizeRole(everyoneRoleName,
"/system/queries/advanced", ActionConstants.GET);
} catch (UserStoreException e) {
String msg = "Failed to set permissions for the system collection.";