NAME

plenigo::AccessRightsManager - A utility class to get/add/remove access rights from/to a customer. 

SYNOPSIS

use plenigo::AccessRightsManager;

# Prepare configuration

my $use_stage = 0; # set if stage system should be used
my $configuration = plenigo::Configuration->new(access_token => 'ACCESS_TOKEN', use_stage => $use_stage);

# Instantiate access rights manager

my $access_rights = plenigo::AccessRightsManager->new(configuration => $configuration);

# Checking access rights from a customer

my %access_rights = $access_rights->hasAccess($plenigo_customer_id, ['ACCESS_RIGHT_ID']); 
if ($access_rights{'accessGranted'}) {
    # customer has the right to access 
}
else {
    # customer is not allowed to access
}

# Adding access rights to a customer

$access_rights->addAccess($plenigo_customer_id, (details => [{productId => 'ACCESS_RIGHT_ID'}]));

# Removing access rights from a customer

$access_rights->removeAccess($plenigo_customer_id, ['ACCESS_RIGHT_ID']);

DESCRIPTION

plenigo::AccessRightsManager provides functionality to manage access rights of a customer.

METHODS

hasAccess($customer_id, @product_ids)

Test if a customer has access rights.

addAccess($customer_id, %access_request)

Add access rights to a customer.

removeAccess($customer_id, $access_right_unique_id)

Remove access right from a customer.