Fix NETHOME detection issue for examusers, staff and parents
This commit is contained in:
parent
b9985102a8
commit
806220fca1
3 changed files with 22 additions and 9 deletions
|
|
@ -93,9 +93,12 @@ def main():
|
|||
vminfo['User'] = environ.get('USER')
|
||||
vminfo['Groups'] = get_groups(environ.get('USER'))
|
||||
|
||||
if 'teachers' in vminfo['Groups']:
|
||||
nethome = f"/srv/samba/schools/default-school/teachers/{vminfo['User']}"
|
||||
else:
|
||||
for dir in ['teachers','examusers','staff','parents']:
|
||||
potential_path = f"/srv/samba/schools/default-school/{dir}/{vminfo['User']}"
|
||||
if path.isdir(potential_path):
|
||||
nethome = potential_path
|
||||
break
|
||||
if not nethome:
|
||||
result = subprocess.run(['find', '/srv/samba/schools/default-school/students/', '-name', vminfo['User'], '-maxdepth', '2', '-type', 'd'], capture_output=True, text=True, check=False)
|
||||
nethome = result.stdout.splitlines()[0]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue