Commit 2df5a45d authored by Paul Rich's avatar Paul Rich
Browse files

Merge branch 'groupcheck_fix' into 'develop'

Instead of enumerating all groups on the system and comparing, check members of specific queue groups.

See merge request !37
parents d8a3cb46 4df1631a
...@@ -3260,21 +3260,18 @@ class Restriction (Data): ...@@ -3260,21 +3260,18 @@ class Restriction (Data):
retval = False retval = False
retstr = "You are not allowed to submit to the '%s' queue (group restriction)" % self.queue.name retstr = "You are not allowed to submit to the '%s' queue (group restriction)" % self.queue.name
queue_groups = self.value.split(':') queue_groups = self.value.split(':')
try: if '*' in queue_groups:
if '*' in queue_groups: return(True,"")
retval = True
retstr = "" for group_name in queue_groups:
elif grp.getgrgid(pwd.getpwnam(job['user']).pw_gid).gr_name in queue_groups: try:
retval = True if job['user'] in grp.getgrnam(group_name).gr_mem:
retstr = "" retval = True
else: retstr = ""
all_groups = grp.getgrall() break
for group in all_groups: except KeyError:
if group.gr_name in queue_groups and job['user'] in group.gr_mem: retstr = "Group could not be verified for queue restriction."
retval = True
retstr = ""
except KeyError:
retstr = "Group could not be verified for queue restriction."
return retval, retstr return retval, retstr
def maxuserjobs(self, job, queuestate=None): def maxuserjobs(self, job, queuestate=None):
......
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