As per my knowledge you need to do little customization to achieve this.
- Check the roles
- Perform your require action(permission)
code to check logged in user has both roles?
global $user;
$roleA = 'administrator';
$roleB = 'user1';
$roleC = 'some other role';
$user_roles = array_values($user->roles);
if (in_array($roleA, $user_roles) && in_array($roleC, $user_roles)) {
// Do something.
}
elseif (in_array($roleA, $user_roles) && in_array($roleB, $user_roles)) {
// Do something.
}
elseif (in_array($roleB, $user_roles) && in_array($roleC, $user_roles)) {
// Do something.
}
Second option.
You can look Rules module.