/** * Adds site with given site ID to cache * * @param [string] $site_id UUID of site to add to cache * @return [void] */ public function addSiteToCache($site_id) { if (count($this->models) == 0) { $this->rebuildCache(); } else { $site = new Site($this->objectify(array('id' => $site_id)), array('collection' => $this)); $site->fetch(); $cache_membership = $site->info(); if ($org_id) { $org = new Organization(null, array('id' => $org_id)); $cache_membership['membership'] = array('id' => $org_id, 'name' => $org->profile->name, 'type' => 'organization'); } else { $user_id = Session::getValue('user_uuid'); $cache_membership['membership'] = array('id' => $user_id, 'name' => 'Team', 'type' => 'team'); } $this->sites_cache->add($cache_membership); } }
/** * Give the URL for collection data fetching * * @return string URL to use in fetch query */ protected function getFetchUrl() { $url = 'sites/' . $this->site->get('id') . '/memberships/users'; return $url; }
/** * Adds a site to this organization * * @param Site $site Site object of site to add to this organization * @return Workflow */ public function addMember(Site $site) { $workflow = $this->organization->workflows->create('add_organization_site_membership', array('params' => array('site_id' => $site->get('id'), 'role' => 'team_member'))); return $workflow; }