Commit 3779f54c authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add check for admin user in console routine, and always return tipacl

info to admin users.
parent 8e436d91
......@@ -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(...).
......@@ -2949,6 +2963,7 @@ class node:
return EmulabResponse(RESPONSE_BADARGS,
output="Improperly formed node value!")
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 "
......@@ -2958,7 +2973,8 @@ class node:
if len(res) == 0:
return EmulabResponse(RESPONSE_ERROR,
output="No such node: " + argdict["node"])
output="No permission to access node: " +
argdict["node"])
trust = DBQueryFatal("SELECT trust FROM group_membership "
"WHERE uid=%s and pid=%s and gid=%s",
......@@ -2969,6 +2985,7 @@ class node:
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",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment