X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fpersons%2Fperson.php;h=0f26168fd897164683d286d91bd95c221ed14aac;hb=a8fb1ae7c741148c7ad46c74784f4f8b4699199e;hp=4e978af3540637e70c28d46abc9746173c72fe8b;hpb=32ab82a1b33e6d4f8308da9f269fbd7b545d9e12;p=plewww.git diff --git a/planetlab/persons/person.php b/planetlab/persons/person.php index 4e978af..0f26168 100644 --- a/planetlab/persons/person.php +++ b/planetlab/persons/person.php @@ -101,7 +101,7 @@ if ($local_peer && $privileges && ! $is_my_account) 'confirm'=>"Are you sure you want to enable $first_name $last_name"); // delete -if ($local_peer && $privileges && $local_peer) +if ($local_peer && $privileges && $local_peer && ! $is_my_account) $tabs['Delete'] = array ('method'=>'POST', 'url'=>l_actions(), 'values'=> array ('person_id'=>$person_id, @@ -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();