allow loginShell to be optional

pull/45/head
Max Erenberg 11 months ago
parent 7d3e03e7fd
commit 5200259cfa
  1. 7
      ceod/model/User.py

@ -24,7 +24,7 @@ class User:
program: Union[str, None] = None,
terms: Union[List[str], None] = None,
non_member_terms: Union[List[str], None] = None,
login_shell: str = '/bin/bash',
login_shell: Union[str, None] = '/bin/bash',
uid_number: Union[int, None] = None,
gid_number: Union[int, None] = None,
home_directory: Union[str, None] = None,
@ -82,7 +82,6 @@ class User:
'uid': self.uid,
'uid_number': self.uid_number,
'gid_number': self.gid_number,
'login_shell': self.login_shell,
'home_directory': self.home_directory,
'is_club': self.is_club(),
'is_club_rep': self.is_club_rep,
@ -92,6 +91,8 @@ class User:
if self.sn and self.given_name:
data['sn'] = self.sn
data['given_name'] = self.given_name
if self.login_shell:
data['login_shell'] = self.login_shell
if self.terms:
data['terms'] = self.terms
if self.non_member_terms:
@ -159,7 +160,7 @@ class User:
program=attrs.get('program', [None])[0],
terms=attrs.get('term'),
non_member_terms=attrs.get('nonMemberTerm'),
login_shell=attrs['loginShell'][0],
login_shell=attrs.get('loginShell', [None])[0],
uid_number=attrs['uidNumber'][0],
gid_number=attrs['gidNumber'][0],
home_directory=attrs['homeDirectory'][0],

Loading…
Cancel
Save