Commit 4df1631a authored by Benjamin Allen's avatar Benjamin Allen
Browse files

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

Instead of enumerating all groups on the system and comparing, check members of specific queue groups. This change makes CQM compatible with sssd.conf: enumerate = False, and overall is doing less work.
parent d8a3cb46
......@@ -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:
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 = ""
except KeyError:
retstr = "Group could not be verified for queue restriction."
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 = ""
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