git://git.onelab.eu
/
nodeconfig.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fc0cb6e
)
Was only returning site_admin key. Also wasn't checking enabled. Fixed.
author
Faiyaz Ahmed
<faiyaza@cs.princeton.edu>
Thu, 15 Mar 2007 19:43:41 +0000
(19:43 +0000)
committer
Faiyaz Ahmed
<faiyaza@cs.princeton.edu>
Thu, 15 Mar 2007 19:43:41 +0000
(19:43 +0000)
keys.php
patch
|
blob
|
history
diff --git
a/keys.php
b/keys.php
index
dd2e24a
..
542e2b0
100755
(executable)
--- a/
keys.php
+++ b/
keys.php
@@
-13,7
+13,7
@@
// Aaron Klingaman <alk@cs.princeton.edu>
// Copyright (C) 2004 The Trustees of Princeton University
//
// Aaron Klingaman <alk@cs.princeton.edu>
// Copyright (C) 2004 The Trustees of Princeton University
//
-// $Id: keys.php,v 1.
1 2006/11/06 22:02:17
mlhuang Exp $
+// $Id: keys.php,v 1.
2 2006/11/09 20:21:43
mlhuang Exp $
//
// Get admin API handle
//
// Get admin API handle
@@
-43,23
+43,18
@@
if (isset($_REQUEST['site_admin'])) {
$node = $nodes[0];
}
}
$node = $nodes[0];
}
}
-
if (isset($node)) {
// Look up the site
$sites = $adm->GetSites(array($node['site_id']));
if (isset($node)) {
// Look up the site
$sites = $adm->GetSites(array($node['site_id']));
+ // Can't filter on roles so have to bruit force through entire userlist of site.
if ($sites && $sites[0]['person_ids']) {
if ($sites && $sites[0]['person_ids']) {
- // XXX Implement API query filters
- // $persons = $adm->GetPersons(array('person_id' => $sites[0]['person_ids'],
- // 'roles' => array('pi')));
- // $persons += $adm->GetPersons(array('person_id' => $sites[0]['person_ids'],
- // 'roles' => array('tech')));
$all_persons = $adm->GetPersons($sites[0]['person_ids']);
foreach ($all_persons as $person) {
$all_persons = $adm->GetPersons($sites[0]['person_ids']);
foreach ($all_persons as $person) {
- if (in_array('pi', $person['roles']) ||
-
in_array('tech', $person['roles'])
) {
- $persons[] = $person;
- }
- }
+ if ((in_array('pi', $person['roles']) || in_array('tech', $person['roles'])) &&
+
$person['enabled']
) {
+ $persons[] = $person;
+
}
+
}
}
}
}
}
}
}
@@
-68,14
+63,15
@@
if (isset($_REQUEST['root'])) {
$keys[] = array('key' => file_get_contents(PLC_ROOT_SSH_KEY_PUB));
}
$keys[] = array('key' => file_get_contents(PLC_ROOT_SSH_KEY_PUB));
}
+
if (!empty($persons)) {
$key_ids = array();
foreach ($persons as $person) {
if (!empty($persons)) {
$key_ids = array();
foreach ($persons as $person) {
- $key_ids
= $key_ids + $person['key_ids'
];
+ $key_ids
[] = $person['key_ids'][0
];
}
if (!empty($key_ids)) {
}
if (!empty($key_ids)) {
- $keys = $
keys + $
adm->GetKeys($key_ids);
+ $keys = $adm->GetKeys($key_ids);
}
}
}
}