Search in sources :

Example 1 with PrivilegedConsentManager

use of org.wso2.carbon.consent.mgt.core.PrivilegedConsentManager in project carbon-identity-framework by wso2.

the class TenantConsentMgtListener method deleteAllConsents.

/**
 * Delete all consents belongs to a given tenant id.
 *
 * @param tenantId The id of the tenant.
 * @throws StratosException throws when an error occurs in deleting consents.
 */
protected void deleteAllConsents(int tenantId) throws StratosException {
    try {
        PrivilegedConsentManager privilegedConsentManager = IdentityConsentDataHolder.getInstance().getPrivilegedConsentManager();
        privilegedConsentManager.deletePurposeCategories(tenantId);
        privilegedConsentManager.deletePIICategories(tenantId);
        privilegedConsentManager.deletePurposes(tenantId);
        privilegedConsentManager.deleteReceipts(tenantId);
    } catch (ConsentManagementException e) {
        throw new StratosException("Error in deleting consents of tenant:" + tenantId, e);
    }
}
Also used : PrivilegedConsentManager(org.wso2.carbon.consent.mgt.core.PrivilegedConsentManager) ConsentManagementException(org.wso2.carbon.consent.mgt.core.exception.ConsentManagementException) StratosException(org.wso2.carbon.stratos.common.exception.StratosException)

Aggregations

PrivilegedConsentManager (org.wso2.carbon.consent.mgt.core.PrivilegedConsentManager)1 ConsentManagementException (org.wso2.carbon.consent.mgt.core.exception.ConsentManagementException)1 StratosException (org.wso2.carbon.stratos.common.exception.StratosException)1