X-Git-Url: http://git.onelab.eu/?p=plewww.git;a=blobdiff_plain;f=planetlab%2Fpersons%2Fperson.php;h=0f26168fd897164683d286d91bd95c221ed14aac;hp=801a55b0ccc2f9a747d679c5b1e189ced76613e8;hb=a8fb1ae7c741148c7ad46c74784f4f8b4699199e;hpb=9b8b74f6feeb99e0222717f0e1ed2f6e51f7b55b diff --git a/planetlab/persons/person.php b/planetlab/persons/person.php index 801a55b..0f26168 100644 --- a/planetlab/persons/person.php +++ b/planetlab/persons/person.php @@ -292,19 +292,22 @@ if ($local_peer) { $table->row_end(); } - $table->row_start(); - - // get list of local sites that the person is not in - function get_site_id ($site) { return $site['site_id'];} - $person_site_ids=array_map("get_site_id",$sites); - $relevant_sites= $api->GetSites( array("peer_id"=>NULL,"~site_id"=>$person_site_ids, '-SORT'=>'name'), $site_columns); - // xxx cannot use onchange=submit() - would need to somehow pass action name - function site_selector($site) { return array('display'=>$site['name'],"value"=>$site['site_id']); } - $selectors = array_map ("site_selector",$relevant_sites); - $table->cell ($form->select_html("site_id",$selectors,array('label'=>"Choose a site to add")). - $form->submit_html("add-person-to-site","Add in site"), - array('hfill'=>true,'align'=>'right')); - $table->row_end(); + if (plc_is_admin()) + { + // NOTE: only admins can add users to different sites. + $table->row_start(); + // get list of local sites that the person is not in + function get_site_id ($site) { return $site['site_id'];} + $person_site_ids=array_map("get_site_id",$sites); + $relevant_sites= $api->GetSites( array("peer_id"=>NULL,"~site_id"=>$person_site_ids, '-SORT'=>'name'), $site_columns); + // xxx cannot use onchange=submit() - would need to somehow pass action name + function site_selector($site) { return array('display'=>$site['name'],"value"=>$site['site_id']); } + $selectors = array_map ("site_selector",$relevant_sites); + $table->cell ($form->select_html("site_id",$selectors,array('label'=>"Choose a site to add")). + $form->submit_html("add-person-to-site","Add in site"), + array('hfill'=>true,'align'=>'right')); + $table->row_end(); + } } $table->end(); $toggle->end();