Adding Portal user type distributor

Hello,

We need to add a portal user type called distributor, this user should have access to all its account cases but also access to the all cases from all accounts linked to his account listed in Member organizations.

to summarize the portal account type will be :
user: access to his own cases only
account: access to all his own account cases only
distributor: access to all his own account cases AND cases of accounts listed in “Member organization”

If it can be useful to anyone, I will try to create it and send a pull request,
if someone has some tips or comments, it will help me a lot as i’m not a full time developer.

Thanks,
BM.

I’m stuck on a very simple task… getting the list of member organization id linked to contact account.
i’m doing something like this in sugarcasesconnection.php function getCases

case ‘Distributor’:
$accounts =$this->restClient->getRelationships(‘Accounts’, $contact->account_id,’[color=#ff0000]accounts[/color]’,’’,$this->account_fields);

            break;

but no way to get a reply, probably due to bad name in bold… but cannot sort it out…
can someone please help me ?

in fact was simple…

case 'ParentAccount':
                $cases = $this->fromSugarCases($this->restClient->getRelationships('Accounts', $contact->account_id,'cases','',$this->case_fields));
                $accounts = $this->restClient->getEntryList('Accounts', "accounts.parent_id = '".$contact->account_id."'",'','',$this->account_fields);
                foreach($accounts['entry_list'] as $account){
                    $cases = $this->addSugarCases($cases,$this->restClient->getRelationships('Accounts', $account['id'],'cases','',$this->case_fields));
                }            
                break;
 private function addSugarCases($cases, $sugarcases){
        
        foreach($sugarcases['entry_list'] as $sugarcase){
            $cases[] = new SugarCase($sugarcase);
        }
        return $cases;
    }

adding a pull request to joomla portal…

2 Likes