Skip to content

Commit

Permalink
read sudoers entry from existing object.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhadfield committed Sep 30, 2016
1 parent a91e00f commit a6bbf38
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/creds/users.py
Expand Up @@ -196,11 +196,11 @@ def from_passwd(uid_min=None, uid_max=None, sudoers=None):
home_dir=text_type(pwd_entry.pw_dir),
shell=text_type(pwd_entry.pw_shell),
public_keys=read_authorized_keys(username=pwd_entry.pw_name),
sudoers_entry=get_sudoers_entry(username=pwd_entry.pw_name, sudoers_entries=sudoers_entries))
sudoers_entry=get_sudoers_entry(username=pwd_entry.pw_name,
sudoers_entries=sudoers_entries))
users.append(user)
return users


@staticmethod
def construct_user_list(raw_users=None):
"""Construct a list of User objects from a list of dicts."""
Expand All @@ -217,7 +217,9 @@ def construct_user_list(raw_users=None):
home_dir=user_dict.get('home_dir'),
gecos=user_dict.get('gecos'),
shell=user_dict.get('shell'),
public_keys=public_keys))
public_keys=public_keys,
sudoers_entry=user_dict.get('sudoers_entry')))

return users

def to_dict(self):
Expand Down

0 comments on commit a6bbf38

Please sign in to comment.