Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-stable
Commits
3779f54c
Commit
3779f54c
authored
Aug 30, 2005
by
Leigh B. Stoller
Browse files
Add check for admin user in console routine, and always return tipacl
info to admin users.
parent
8e436d91
Changes
1
Hide whitespace changes
Inline
Side-by-side
xmlrpc/emulabserver.py.in
View file @
3779f54c
...
...
@@ -227,6 +227,20 @@ def CheckNodePermission(uid, node):
return
CheckExptPermission
(
uid
,
res
[
0
][
0
],
res
[
0
][
1
])
#
# Check if user is an admin person
#
def
CheckIsAdmin
(
uid
):
res
=
DBQueryFatal
(
"SELECT admin FROM users "
"WHERE uid=%s"
,
(
uid
,))
if
len
(
res
)
==
0
:
return
EmulabResponse
(
RESPONSE_ERROR
,
output
=
"No such user: "
+
uid
)
return
res
[
0
][
0
];
#
# This is a wrapper class so that you can invoke methods in dotted form.
# For example experiment.swapexp(...).
...
...
@@ -2948,27 +2962,30 @@ class node:
if
not
re
.
match
(
"^[-\w]*$"
,
str
(
argdict
[
"node"
])):
return
EmulabResponse
(
RESPONSE_BADARGS
,
output
=
"Improperly formed node value!"
)
# XXX Refactor the trust stuff
res
=
DBQueryFatal
(
"SELECT e.pid,e.gid FROM reserved AS r "
"left join experiments as e on "
" e.pid=r.pid and e.eid=r.eid "
"WHERE r.node_id=%s"
,
(
argdict
[
"node"
],))
if
len
(
res
)
==
0
:
return
EmulabResponse
(
RESPONSE_ERROR
,
output
=
"No such node: "
+
argdict
[
"node"
])
if
not
CheckIsAdmin
(
self
.
uid
):
# XXX Refactor the trust stuff
res
=
DBQueryFatal
(
"SELECT e.pid,e.gid FROM reserved AS r "
"left join experiments as e on "
" e.pid=r.pid and e.eid=r.eid "
"WHERE r.node_id=%s"
,
(
argdict
[
"node"
],))
trust
=
DBQueryFatal
(
"SELECT trust FROM group_membership "
"WHERE uid=%s and pid=%s and gid=%s"
,
(
self
.
uid
,
res
[
0
][
0
],
res
[
0
][
1
]))
if
len
(
res
)
==
0
:
return
EmulabResponse
(
RESPONSE_ERROR
,
output
=
"No permission to access node: "
+
argdict
[
"node"
])
if
len
(
trust
)
==
0
:
return
EmulabResponse
(
RESPONSE_FORBIDDEN
,
output
=
(
"You do not have permission to access: "
+
argdict
[
"node"
]))
trust
=
DBQueryFatal
(
"SELECT trust FROM group_membership "
"WHERE uid=%s and pid=%s and gid=%s"
,
(
self
.
uid
,
res
[
0
][
0
],
res
[
0
][
1
]))
if
len
(
trust
)
==
0
:
return
EmulabResponse
(
RESPONSE_FORBIDDEN
,
output
=
(
"You do not have permission to access: "
+
argdict
[
"node"
]))
pass
res
=
DBQueryFatal
(
"SELECT server,portnum,keylen,keydata "
"FROM tiplines WHERE node_id=%s"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment