@Override public void deletePolicy(String policyId) throws EntitlementException { Registry registry = EntitlementServiceComponent. getGovernanceRegistry(CarbonContext.getThreadLocalCarbonContext().getTenantId()); try { if (registry.resourceExists(PDPConstants.ENTITLEMENT_POLICY_VERSION + policyId)) { registry.delete(PDPConstants.ENTITLEMENT_POLICY_VERSION + policyId); } } catch (RegistryException e) { log.error("Error while deleting all versions of policy", e); } }
@Override public void deletePolicy(String policyId) throws EntitlementException { Registry registry = EntitlementServiceComponent. getGovernanceRegistry(CarbonContext.getThreadLocalCarbonContext().getTenantId()); try { if (registry.resourceExists(PDPConstants.ENTITLEMENT_POLICY_VERSION + policyId)) { registry.delete(PDPConstants.ENTITLEMENT_POLICY_VERSION + policyId); } } catch (RegistryException e) { log.error("Error while deleting all versions of policy", e); } }
@Override public void deletePolicy(String policyId) throws EntitlementException { Registry registry = EntitlementServiceComponent. getGovernanceRegistry(CarbonContext.getThreadLocalCarbonContext().getTenantId()); try { if (registry.resourceExists(PDPConstants.ENTITLEMENT_POLICY_VERSION + policyId)) { registry.delete(PDPConstants.ENTITLEMENT_POLICY_VERSION + policyId); } } catch (RegistryException e) { log.error("Error while deleting all versions of policy", e); } }
/** * Rename the registry path node name for a deleted Service provider role. * * @param oldName * @param newName * @throws IdentityApplicationManagementException */ public static void renameAppPermissionPathNode(String oldName, String newName) throws IdentityApplicationManagementException { List<ApplicationPermission> loadPermissions = loadPermissions(oldName); String newApplicationNode = ApplicationMgtUtil.getApplicationPermissionPath() + PATH_CONSTANT + oldName; Registry tenantGovReg = CarbonContext.getThreadLocalCarbonContext().getRegistry( RegistryType.USER_GOVERNANCE); //creating new application node try { for (ApplicationPermission applicationPermission : loadPermissions) { tenantGovReg.delete(newApplicationNode + PATH_CONSTANT + applicationPermission.getValue()); } tenantGovReg.delete(newApplicationNode); Collection permissionNode = tenantGovReg.newCollection(); permissionNode.setProperty("name", newName); newApplicationNode = ApplicationMgtUtil.getApplicationPermissionPath() + PATH_CONSTANT + newName; ApplicationMgtUtil.applicationNode = newApplicationNode; tenantGovReg.put(newApplicationNode, permissionNode); addPermission(loadPermissions.toArray(new ApplicationPermission[loadPermissions.size()]), tenantGovReg); } catch (RegistryException e) { throw new IdentityApplicationManagementException("Error while renaming permission node " + oldName + "to " + newName, e); } }
/** * Delete the resource * * @param applicationName * @throws IdentityApplicationManagementException */ public static void deletePermissions(String applicationName) throws IdentityApplicationManagementException { String applicationNode = getApplicationPermissionPath() + PATH_CONSTANT + applicationName; Registry tenantGovReg = CarbonContext.getThreadLocalCarbonContext().getRegistry( RegistryType.USER_GOVERNANCE); try { boolean exist = tenantGovReg.resourceExists(applicationNode); if (exist) { tenantGovReg.delete(applicationNode); } } catch (RegistryException e) { throw new IdentityApplicationManagementException("Error while storing permissions", e); } }
/** * Delete the resource * * @param applicationName * @throws IdentityApplicationManagementException */ public static void deletePermissions(String applicationName) throws IdentityApplicationManagementException { String applicationNode = getApplicationPermissionPath() + PATH_CONSTANT + applicationName; Registry tenantGovReg = CarbonContext.getThreadLocalCarbonContext().getRegistry( RegistryType.USER_GOVERNANCE); try { boolean exist = tenantGovReg.resourceExists(applicationNode); if (exist) { tenantGovReg.delete(applicationNode); } } catch (RegistryException e) { throw new IdentityApplicationManagementException("Error while storing permissions", e); } }
String path = RegistryConstants.PROFILES_PATH + userName; if (registry.resourceExists(path)) { registry.delete(path);
String path = RegistryConstants.PROFILES_PATH + userName; if (registry.resourceExists(path)) { registry.delete(path);
registry.delete(policyPath + olderVersion);
registry.delete(policyPath + olderVersion);
registry.delete(policyPath + olderVersion);