def work(username, loginShell, homeFolder, password, amendment): # creates or deletes comments = [] if sp.main(username, loginShell, homeFolder, password, amendment): comments.append('user-ID is created !\n') if ss.main(new_user, amendment): comments.append('sudo - permissions are created !') return ''.join(comments)
def work(username, loginShell, homeFolder, password, amendment, sudoers): # creates or deletes comments = [] if amendment in ['create', 'modify', 'delete'] and \ sp.main(username, loginShell, homeFolder, password, amendment): comments.append('user-ID is created !\n') if sudoers == 'yes' and ss.main(new_user, amendment): comments.append('sudo - permissions are created !') return ''.join(comments)
def run_check(user, shell, homefolder): comments = [] current_user_details = sp.user_exists(user) if current_user_details: comments.append('Username - match found as [%s]:\n\t[[%s]]' % (user, current_user_details)) if not sp.shell_exists(shell): comments.append('%s - No such shell exists!' % shell) if sp.homefolder_exists(homefolder): comments.append('%s - Home Folder already exists!' % homefolder) if ss.main(user, 'check'): comments.append('%s - Sudoers permissions already exists!' % homefolder) return '\n'.join(comments)