/** * Fetch the list of account id's associated to this user * @return array List of account id's associated to this user */ protected function getAccountIds($bean) { static $accounts; if (!isset($accounts)) { // If the portal user isn't linked to any accounts they can only do anything with Contacts and Bugs // Get the account_id list and make sure there is something on it. $vis = new SupportPortalVisibility($bean); $accounts = $vis->getAccountIds(); } return $accounts; }
/** * Enforces module specific ACLs for users without accounts * * @param array $acls * @return array */ protected function enforceModuleACLs(array $acls) { $apiPerson = $this->getPortalContact(); // This is a change in the ACL's for users without Accounts $vis = new SupportPortalVisibility($apiPerson); $accounts = $vis->getAccountIds(); if (count($accounts) == 0) { // This user has no accounts, modify their ACL's so that they match up with enforcement $acls['Accounts']['access'] = 'no'; $acls['Cases']['access'] = 'no'; } foreach ($acls as $modName => $modAcls) { if ($modName === 'Contacts') { continue; } $acls[$modName]['edit'] = 'no'; } return $acls; }