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):
retval = False
retstr = "You are not allowed to submit to the '%s' queue (group restriction)" % self.queue.name
queue_groups = self.value.split(':')
try:
if '*' in queue_groups:
return(True,"")
for group_name in queue_groups:
try:
if job['user'] in grp.getgrnam(group_name).gr_mem:
retval = True
retstr = ""
elif grp.getgrgid(pwd.getpwnam(job['user']).pw_gid).gr_name in queue_groups:
retval = True
retstr = ""
else:
all_groups = grp.getgrall()
for group in all_groups:
if group.gr_name in queue_groups and job['user'] in group.gr_mem:
retval = True
retstr = ""
break
except KeyError:
retstr = "Group could not be verified for queue restriction."
return retval, retstr
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