Example #1
0
 /**
  * Fetches organizational memberships for user
  *
  * @return array $data Properties below:
  *         [string] id   UUID of membership join
  *         [string] name Name of organization
  *         [string] type Always "organization"
  */
 private function fetchUserOrganizations()
 {
     $response = $this->request->pagedRequest('users/' . Session::getValue('user_uuid') . '/memberships/organizations');
     $data = array();
     foreach ($response['data'] as $membership) {
         if ($membership->role == 'unprivileged') {
             // Users with unprivileged role in organizations can't see organization
             // sites, but must be added to the team
             continue;
         }
         $data[] = array('id' => $membership->id, 'name' => $membership->organization->profile->name, 'type' => 'organization');
     }
     return $data;
 }