You are here

function sharedemail_subuser_sharedemail_policy_info in Shared Email 6

Implementation of hook_sharedemail_policy_info().

Only subusers may share email addresses. Because this policy denies parent accounts the ability to share email addresses, there is nothing to gain by guaranteeing that subuser accounts can only share with their 'siblings'.

File

modules/sharedemail_subuser/sharedemail_subuser.module, line 76
Integrate Subuser and Shared Email modules.

Code

function sharedemail_subuser_sharedemail_policy_info($uid, $parent_uid, $existing, $mail) {
  if ($parent_uid == NULL) {

    // If the user accounts that share this address are subusers of the current
    // account, allow the account to share the email address.
    $subusers = subuser_get_subusers($uid);
    $non_subusers = array_diff($existing, $subusers);
    if (empty($non_subusers)) {
      return TRUE;
    }
    return FALSE;
  }
  return TRUE;
}