bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
def validate_home_dir(home=home, login=login, system=system, force=force): """ Do some basic but sane tests on the home dir provided. """
|
def validate_home_dir(home=home, login=login, system=system, force=force): """ Do some basic but sane tests on the home dir provided. """
| 477,900
|
def validate_home_dir(home=home, login=login, system=system, force=force): """ Do some basic but sane tests on the home dir provided. """
|
def validate_home_dir(home=home, login=login, system=system, force=force): """ Do some basic but sane tests on the home dir provided. """
| 477,901
|
def clear_term(): sys.stdout.write(clear) sys.stdout.flush()
|
defclear_term():sys.stdout.write(clear)sys.stdout.flush()
| 477,902
|
def cmdfmt(cmd): '''convert a sequence to a colorized string.''' return styles.stylize(styles.ST_NAME, ' '.join(cmd))
|
defcmdfmt(cmd):'''convertasequencetoacolorizedstring.'''returnstyles.stylize(styles.ST_NAME,''.join(cmd))
| 477,903
|
def test_message(msg): """ display a message to stderr. """ sys.stderr.write("%s>>> %s%s\n" % (styles.colors[styles.ST_LOG], msg, styles.colors[styles.ST_NO]) )
|
deftest_message(msg):"""displayamessagetostderr."""sys.stderr.write("%s>>>%s%s\n"%(styles.colors[styles.ST_LOG],msg,styles.colors[styles.ST_NO]))
| 477,904
|
def log_and_exec (command, inverse_test=False, result_code=0, comment="", verb=verbose): """Display a command, execute it, and exit if soemthing went wrong.""" #if not command.startswith('colordiff'): # command += ' %s' % ' '.join(args) sys.stderr.write("%s>>> running %s%s%s\n" % (styles.colors[styles.ST_LOG], styles.colors[styles.ST_PATH], command, styles.colors[styles.ST_NO])) output, retcode = execute(command) must_exit = False # # TODO: implement a precise test on a precise exit value. # for example, when you try to add a group with an invalid name, # licorn-add should exit (e.g.) 34. We must test on this precise # value and not on != 0, because if something wrong but *other* than # errno 34 happened, we won't know it if we don't check carefully the # program output. # if inverse_test: if retcode != result_code: must_exit = True else: if retcode != 0: must_exit = True if must_exit: if inverse_test: test = (" %s→ it should have failed with reason: %s%s%s\n" % (styles.colors[styles.ST_PATH], styles.colors[styles.ST_BAD], comment, styles.colors[styles.ST_NO])) else: test = "" sys.stderr.write(" %s→ return code of command: %s%d%s (expected: %d)%s\n%s → log follows:\n" % ( styles.colors[styles.ST_LOG], styles.colors[styles.ST_BAD], retcode, styles.colors[styles.ST_LOG], result_code, styles.colors[styles.ST_NO], test) ) sys.stderr.write(output) sys.stderr.write( "The last command failed to execute, or return something wrong !\n") raise SystemExit(retcode) if verb: sys.stderr.write(output)
|
deflog_and_exec(command,inverse_test=False,result_code=0,comment="",verb=verbose):"""Displayacommand,executeit,andexitifsoemthingwentwrong."""#ifnotcommand.startswith('colordiff'):# command+='%s'%''.join(args)sys.stderr.write("%s>>>running%s%s%s\n"%(styles.colors[styles.ST_LOG],styles.colors[styles.ST_PATH],command,styles.colors[styles.ST_NO]))output,retcode=execute(command)must_exit=False##TODO:implementaprecisetestonapreciseexitvalue.#forexample,whenyoutrytoaddagroupwithaninvalidname,#licorn-addshouldexit(e.g.)34.Wemusttestonthisprecise#valueandnoton!=0,becauseifsomethingwrongbut*other*than#errno34happened,wewon'tknowitifwedon'tcheckcarefullythe#programoutput.#ifinverse_test:ifretcode!=result_code:must_exit=Trueelse:ifretcode!=0:must_exit=Trueifmust_exit:ifinverse_test:test=(" %s→itshouldhavefailedwithreason:%s%s%s\n"%(styles.colors[styles.ST_PATH],styles.colors[styles.ST_BAD],comment,styles.colors[styles.ST_NO]))else:test=""sys.stderr.write(" %s→returncodeofcommand:%s%d%s(expected:%d)%s\n%s →logfollows:\n"%( styles.colors[styles.ST_LOG],styles.colors[styles.ST_BAD],retcode,styles.colors[styles.ST_LOG],result_code,styles.colors[styles.ST_NO],test))sys.stderr.write(output)sys.stderr.write("Thelastcommandfailedtoexecute,orreturnsomethingwrong!\n")raiseSystemExit(retcode)ifverb:sys.stderr.write(output)
| 477,905
|
def strip_dates(str): """ strip dates from warnings and traces, else outputs and references always compare false .""" return re.sub(r'\s\[\d\d\d\d/\d\d/\d\d\s\d\d:\d\d:\d\d\.\d\d\d\d\]\s', r' [D/T] ', str)
|
defstrip_dates(str):"""stripdatesfromwarningsandtraces,elseoutputsandreferencesalwayscomparefalse."""returnre.sub(r'\s\[\d\d\d\d/\d\d/\d\d\s\d\d:\d\d:\d\d\.\d\d\d\d\]\s',r'[D/T]',str)
| 477,906
|
def Prepare(self, cmd): """ Run commands mandatory for func_test to succeed. """
|
def Prepare(self, cmd): """ Run commands mandatory for func_test to succeed. """
| 477,907
|
def RunAndCheck(self, cmd, batch = False, inverse_test=False): ref_output, ref_code = self.PrepareReferenceOutput(cmd)
|
def RunAndCheck(self, cmd, batch = False, inverse_test=False): ref_output, ref_code = self.PrepareReferenceOutput(cmd)
| 477,908
|
def __add_group(self, name, system, manual_gid=None, description = "", groupSkel = "", batch=False, force=False): """ Add a POSIX group, write the system data files. Return the gid of the group created."""
|
def __add_group(self, name, system, manual_gid=None, description = "", groupSkel = "", batch=False, force=False): """ Add a POSIX group, write the system data files. Return the gid of the group created."""
| 477,909
|
def forgery_error(title): return (w.HTTP_TYPE_TEXT, w.page(title, w.error(_("Forbidden action"), [ _("Some parts of the system cannot be modified.") ], _("insufficient permissions to perform operation."))))
|
def forgery_error(title): return (HTTP_TYPE_TEXT, page(title, error(_("Forbidden action"), [ _("Some parts of the system cannot be modified.") ], _("insufficient permissions to perform operation."))))
| 477,910
|
def view(uri, http_user, name): """Prepare a group view to be printed.""" users.reload() groups.reload() title = _("Showing details of group %s") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) u = users.users g = groups.groups # TODO: should we forbid system group view ? why not ? # As of now, this is harmless and I don't see any reason # apart from obfuscation which is not acceptable. # Anyway, to see a system group, user must forge an URL. try: group = g[groups.name_to_gid(name)] members = groups.all_members(name) members.sort() members_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <td><strong>%s</strong></td> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> ''' % (_('Members'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID')) def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid) members_html += "\n".join(map(user_line, members)) + '</table>' if not groups.is_system_group(name): resps = groups.all_members(configuration.groups.resp_prefix + name) resps.sort() guests = \ groups.all_members(configuration.groups.guest_prefix + name) guests.sort() if resps != []: resps_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <th><strong>%s</strong></th> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> %s </table> ''' % (_('Responsibles'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID'), "\n".join(map(user_line, resps))) else: resps_html = "<h2>%s</h2>" % \ _('No responsibles for this group.') if guests != []: guests_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <th><strong>%s</strong></th> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> %s </table> ''' % (_('Guests'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID'), "\n".join(map(user_line, guests))) else: guests_html = "<h2>%s</h2>" % _('No guests for this group.') else: resps_html = guests_html = '' form_name = "group_print_form" data += ''' <div id="content"> <form name="%s" id="%s" action="/groups/view/%s" method="post"> <table id="user_account"> <tr><td><strong>%s</strong><br />%s</td> <td class="not_modifiable">%d</td></tr> <tr><td><strong>%s</strong><br />%s</td> <td class="not_modifiable">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr> <td>%s</td> <td class="right">%s</td> </tr> </table> </form> </div> ''' % ( form_name, form_name, name, _('GID'), _('immutable'), group['gid'], _('Name'), _('immutable'), name, members_html, resps_html, guests_html, w.button(_('<< Go back'), "/groups/list", accesskey=_('B')), w.submit('print', _('Print') + ' >>', onClick="javascript:window.print(); return false;", accesskey=_('P')) ) except exceptions.LicornException, e: data += w.error(_("Group %s doesn't exist (%s, %s)!") % ( name, "group = g[groups.name_to_gid(name)]", e)) return (w.HTTP_TYPE_TEXT, w.page(title, data))
|
def view(uri, http_user, name): """Prepare a group view to be printed.""" users.reload() groups.reload() title = _("Details of group %s") % name data = w.page_body_start(uri, http_user, ctxtnav, title) u = users.users g = groups.groups # TODO: should we forbid system group view ? why not ? # As of now, this is harmless and I don't see any reason # apart from obfuscation which is not acceptable. # Anyway, to see a system group, user must forge an URL. try: group = g[groups.name_to_gid(name)] members = groups.all_members(name) members.sort() members_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <td><strong>%s</strong></td> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> ''' % (_('Members'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID')) def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid) members_html += "\n".join(map(user_line, members)) + '</table>' if not groups.is_system_group(name): resps = groups.all_members(configuration.groups.resp_prefix + name) resps.sort() guests = \ groups.all_members(configuration.groups.guest_prefix + name) guests.sort() if resps != []: resps_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <th><strong>%s</strong></th> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> %s </table> ''' % (_('Responsibles'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID'), "\n".join(map(user_line, resps))) else: resps_html = "<h2>%s</h2>" % \ _('No responsibles for this group.') if guests != []: guests_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <th><strong>%s</strong></th> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> %s </table> ''' % (_('Guests'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID'), "\n".join(map(user_line, guests))) else: guests_html = "<h2>%s</h2>" % _('No guests for this group.') else: resps_html = guests_html = '' form_name = "group_print_form" data += ''' <div id="content"> <form name="%s" id="%s" action="/groups/view/%s" method="post"> <table id="user_account"> <tr><td><strong>%s</strong><br />%s</td> <td class="not_modifiable">%d</td></tr> <tr><td><strong>%s</strong><br />%s</td> <td class="not_modifiable">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr> <td>%s</td> <td class="right">%s</td> </tr> </table> </form> </div> ''' % ( form_name, form_name, name, _('GID'), _('immutable'), group['gid'], _('Name'), _('immutable'), name, members_html, resps_html, guests_html, w.button(_('<< Go back'), "/groups/list", accesskey=_('B')), w.submit('print', _('Print') + ' >>', onClick="javascript:window.print(); return false;", accesskey=_('P')) ) except exceptions.LicornException, e: data += w.error(_("Group %s doesn't exist (%s, %s)!") % ( name, "group = g[groups.name_to_gid(name)]", e)) return (w.HTTP_TYPE_TEXT, w.page(title, data))
| 477,911
|
def view(uri, http_user, name): """Prepare a group view to be printed.""" users.reload() groups.reload() title = _("Showing details of group %s") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) u = users.users g = groups.groups # TODO: should we forbid system group view ? why not ? # As of now, this is harmless and I don't see any reason # apart from obfuscation which is not acceptable. # Anyway, to see a system group, user must forge an URL. try: group = g[groups.name_to_gid(name)] members = groups.all_members(name) members.sort() members_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <td><strong>%s</strong></td> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> ''' % (_('Members'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID')) def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid) members_html += "\n".join(map(user_line, members)) + '</table>' if not groups.is_system_group(name): resps = groups.all_members(configuration.groups.resp_prefix + name) resps.sort() guests = \ groups.all_members(configuration.groups.guest_prefix + name) guests.sort() if resps != []: resps_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <th><strong>%s</strong></th> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> %s </table> ''' % (_('Responsibles'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID'), "\n".join(map(user_line, resps))) else: resps_html = "<h2>%s</h2>" % \ _('No responsibles for this group.') if guests != []: guests_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <th><strong>%s</strong></th> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> %s </table> ''' % (_('Guests'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID'), "\n".join(map(user_line, guests))) else: guests_html = "<h2>%s</h2>" % _('No guests for this group.') else: resps_html = guests_html = '' form_name = "group_print_form" data += ''' <div id="content"> <form name="%s" id="%s" action="/groups/view/%s" method="post"> <table id="user_account"> <tr><td><strong>%s</strong><br />%s</td> <td class="not_modifiable">%d</td></tr> <tr><td><strong>%s</strong><br />%s</td> <td class="not_modifiable">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr> <td>%s</td> <td class="right">%s</td> </tr> </table> </form> </div> ''' % ( form_name, form_name, name, _('GID'), _('immutable'), group['gid'], _('Name'), _('immutable'), name, members_html, resps_html, guests_html, w.button(_('<< Go back'), "/groups/list", accesskey=_('B')), w.submit('print', _('Print') + ' >>', onClick="javascript:window.print(); return false;", accesskey=_('P')) ) except exceptions.LicornException, e: data += w.error(_("Group %s doesn't exist (%s, %s)!") % ( name, "group = g[groups.name_to_gid(name)]", e)) return (w.HTTP_TYPE_TEXT, w.page(title, data))
|
def view(uri, http_user, name): """Prepare a group view to be printed.""" users.reload() groups.reload() title = _("Showing details of group %s") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) u = users.users g = groups.groups # TODO: should we forbid system group view ? why not ? # As of now, this is harmless and I don't see any reason # apart from obfuscation which is not acceptable. # Anyway, to see a system group, user must forge an URL. try: group = g[groups.name_to_gid(name)] members = groups.all_members(name) if members != []: members.sort() members_html = ''' <h2>%s</h2> <div style="text-align:left;">%s</div> <table class="group_members"> <tr> <th><strong>%s</strong></th> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> ''' % ( _('Members'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID') ) def user_line(login): uid = users.login_to_uid(login) return '''<tr> <td>%s</td> <td>%s</td> <td>%s</td> </tr>''' % ( u[uid]['gecos'], login, uid ) members_html += "\n".join(map(user_line, members)) + '</table>' else: members_html = "<h2>%s</h2>" % _('No members in this group.') if not groups.is_system_group(name): resps = groups.all_members(configuration.groups.resp_prefix + name) resps.sort() guests = \ groups.all_members(configuration.groups.guest_prefix + name) guests.sort() if resps != []: resps_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <th><strong>%s</strong></th> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> %s </table> ''' % (_('Responsibles'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID'), "\n".join(map(user_line, resps))) else: resps_html = "<h2>%s</h2>" % \ _('No responsibles for this group.') if guests != []: guests_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <th><strong>%s</strong></th> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> %s </table> ''' % (_('Guests'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID'), "\n".join(map(user_line, guests))) else: guests_html = "<h2>%s</h2>" % _('No guests for this group.') else: resps_html = guests_html = '' form_name = "group_print_form" data += ''' <div id="content"> <form name="%s" id="%s" action="/groups/view/%s" method="post"> <table id="user_account"> <tr><td><strong>%s</strong><br />%s</td> <td class="not_modifiable">%d</td></tr> <tr><td><strong>%s</strong><br />%s</td> <td class="not_modifiable">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr> <td>%s</td> <td class="right">%s</td> </tr> </table> </form> </div> ''' % ( form_name, form_name, name, _('GID'), _('immutable'), group['gid'], _('Name'), _('immutable'), name, members_html, resps_html, guests_html, w.button(_('<< Go back'), "/groups/list", accesskey=_('B')), w.submit('print', _('Print') + ' >>', onClick="javascript:window.print(); return false;", accesskey=_('P')) ) except exceptions.LicornException, e: data += w.error(_("Group %s doesn't exist (%s, %s)!") % ( name, "group = g[groups.name_to_gid(name)]", e)) return (w.HTTP_TYPE_TEXT, w.page(title, data))
| 477,912
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
| 477,913
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
| 477,914
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
| 477,915
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
| 477,916
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
| 477,917
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
| 477,918
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
| 477,919
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
|
def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % ( u[uid]['gecos'], login, uid)
| 477,920
|
def check_user(user, minimal = minimal, batch = batch, auto_answer = auto_answer):
|
def check_user(user, minimal = minimal, batch = batch, auto_answer = auto_answer):
| 477,921
|
def SetMissingMandatoryDefauts(self): """ The defaults set here are expected to exist by other parts of the programs. """
|
def SetMissingMandatoryDefauts(self): """ The defaults set here are expected to exist by other parts of the programs. """
| 477,922
|
def CheckBaseDirs(self, minimal = True, batch = False, auto_answer = None) : """Check and eventually repair default needed dirs."""
|
def CheckBaseDirs(self, minimal = True, batch = False, auto_answer = None) : """Check and eventually repair default needed dirs."""
| 477,923
|
def CheckBaseDirs(self, minimal = True, batch = False, auto_answer = None) : """Check and eventually repair default needed dirs."""
|
def CheckBaseDirs(self, minimal = True, batch = False, auto_answer = None) : """Check and eventually repair default needed dirs."""
| 477,924
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_('''<em>Click to edit current user account parameters:</em> <br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> ''') % ( uid, u[uid]['gidNumber'], g[u[uid]['gidNumber']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter( lambda x: x in gst_grps, u[uid]['groups'])))).replace( '<','<').replace('>','>')
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_('''<em>Click to edit current user account parameters:</em> <br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> ''') % ( uid, u[uid]['gidNumber'], g[u[uid]['gidNumber']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter( lambda x: x in gst_grps, u[uid]['groups'])))).replace( '<','<').replace('>','>')
| 477,925
|
def last_init_check(self): """ do a quick LDAP content check, to validate everything is valid. """
|
def last_init_check(self): """ do a quick LDAP content check, to validate everything is valid. """
| 477,926
|
def ctxtnav(active = True): if active: disabled = ''; onClick = ''; else: disabled = 'un-clickable'; onClick = 'onClick="javascript: return(false);"' return ''' <div id="ctxtnav" class="nav"> <h2>Context Navigation</h2> <ul> <li><a href="/users/new" title="%s" %s class="%s"><div class="ctxt-icon %s" id="icon-add">%s</div></a></li> <li><a href="/users/import" title="%s" %s class="%s"><div class="ctxt-icon %s" id="icon-import">%s</div></a></li> <li><a href="/users/export" title="%s" %s class="%s"><div class="ctxt-icon %s" id="icon-export">%s</div></a></li> </ul> </div> ''' % ( _("Add a new user account on the system."), onClick, disabled, disabled, _("Add an account"), _("Import new user accounts from a CSV-delimited file."), onClick, disabled, disabled, _("Import accounts"), _("Export current user accounts list to a CSV or XML file."), onClick, disabled, disabled, _("Export accounts") )
|
def ctxtnav(active = True): if active: disabled = ''; onClick = ''; else: disabled = 'un-clickable'; onClick = 'onClick="javascript: return(false);"' return ''' <div id="ctxtnav" class="nav"> <h2>Context Navigation</h2> <ul> <li><a href="/users/new" title="%s" %s class="%s"><div class="ctxt-icon %s" id="icon-add">%s</div></a></li> <li><a href="/users/import" title="%s" %s class="%s"><div class="ctxt-icon %s" id="icon-import">%s</div></a></li> <li><a href="/users/export" title="%s" %s class="%s"><div class="ctxt-icon %s" id="icon-export">%s</div></a></li> </ul> </div> ''' % ( _("Add a new user account on the system."), onClick, disabled, disabled, _("Add an account"), _("Import new user accounts from a CSV-delimited file."), onClick, disabled, disabled, _("Import accounts"), _("Export current user accounts list to a CSV or XML file."), onClick, disabled, disabled, _("Export accounts") )
| 477,927
|
def export(uri, http_user, type = "", yes = None): """ Export user accounts list.""" # TODO: reload(profiles) groups.reload() users.reload() del yes title = _("Export user accounts list") data = '<div id="banner">\n%s\n%s</div>\n%s\n<div id="main">\n%s\n<div id="content"><h1>%s</h1>' % ( w.backto(), w.metanav(http_user), w.menu(uri), ctxtnav(), title) if type == "": description = _('''CSV file-format is used by spreadsheets and most systems which offer import functionnalities. XML file-format is a modern exchange format, used in soma applications which respect interoperability constraints.<br /><br />When you submit this form, your web browser will automatically offer you to download and save the export-file (it won't be displayed). When you're done, please click the “back” button of your browser.''') form_options = _("Which file format do you want accounts to be exported to? %s") % w.select("type", [ "CSV", "XML"]) data += w.question(_("Please choose file format for export list"), description, yes_values = [ _("Export >>"), "/users/export", "E" ], no_values = [ _("<< Cancel"), "/users/list", "N" ], form_options = form_options) data += '</div><!-- end main -->' return w.page(title, data) else: users.Select(users.FILTER_STANDARD) # TODO: convert this. #req.headers_out["Content-type"] = "application/force-download" #req.headers_out["Content-Disposition"] = "attachment; filename=export.%s" % type.lower() #header("Pragma: no-cache"); #header("Expires: 0"); if type == "CSV": return users.ExportCSV() else: return users.ExportXML()
|
def export(uri, http_user, type = "", yes = None): """ Export user accounts list.""" # TODO: reload(profiles) groups.reload() users.reload() del yes title = _("Export user accounts list") data = '<div id="banner">\n%s\n%s</div>\n%s\n<div id="main">\n%s\n<div id="content"><h1>%s</h1>' % ( w.backto(), w.metanav(http_user), w.menu(uri), ctxtnav(), title) if type == "": description = _('''CSV file-format is used by spreadsheets and most systems which offer import functionnalities. XML file-format is a modern exchange format, used in soma applications which respect interoperability constraints.<br /><br />When you submit this form, your web browser will automatically offer you to download and save the export-file (it won't be displayed). When you're done, please click the “back” button of your browser.''') form_options = _("Which file format do you want accounts to be exported to? %s") % w.select("type", [ "CSV", "XML"]) data += w.question(_("Please choose file format for export list"), description, yes_values = [ _("Export >>"), "/users/export", "E" ], no_values = [ _("<< Cancel"), "/users/list", "N" ], form_options = form_options) data += '</div><!-- end main -->' return w.page(title, data) else: users.Select(users.FILTER_STANDARD) # TODO: convert this. #req.headers_out["Content-type"] = "application/force-download" #req.headers_out["Content-Disposition"] = "attachment; filename=export.%s" % type.lower() #header("Pragma: no-cache"); #header("Expires: 0"); if type == "CSV": return users.ExportCSV() else: return users.ExportXML()
| 477,928
|
def export(uri, http_user, type = "", yes = None): """ Export user accounts list.""" # TODO: reload(profiles) groups.reload() users.reload() del yes title = _("Export user accounts list") data = '<div id="banner">\n%s\n%s</div>\n%s\n<div id="main">\n%s\n<div id="content"><h1>%s</h1>' % ( w.backto(), w.metanav(http_user), w.menu(uri), ctxtnav(), title) if type == "": description = _('''CSV file-format is used by spreadsheets and most systems which offer import functionnalities. XML file-format is a modern exchange format, used in soma applications which respect interoperability constraints.<br /><br />When you submit this form, your web browser will automatically offer you to download and save the export-file (it won't be displayed). When you're done, please click the “back” button of your browser.''') form_options = _("Which file format do you want accounts to be exported to? %s") % w.select("type", [ "CSV", "XML"]) data += w.question(_("Please choose file format for export list"), description, yes_values = [ _("Export >>"), "/users/export", "E" ], no_values = [ _("<< Cancel"), "/users/list", "N" ], form_options = form_options) data += '</div><!-- end main -->' return w.page(title, data) else: users.Select(users.FILTER_STANDARD) # TODO: convert this. #req.headers_out["Content-type"] = "application/force-download" #req.headers_out["Content-Disposition"] = "attachment; filename=export.%s" % type.lower() #header("Pragma: no-cache"); #header("Expires: 0"); if type == "CSV": return users.ExportCSV() else: return users.ExportXML()
|
def export(uri, http_user, type = "", yes = None): """ Export user accounts list.""" # TODO: reload(profiles) groups.reload() users.reload() del yes title = _("Export user accounts list") data = '<div id="banner">\n%s\n%s</div>\n%s\n<div id="main">\n%s\n<div id="content"><h1>%s</h1>' % ( w.backto(), w.metanav(http_user), w.menu(uri), ctxtnav(), title) if type == "": description = _('''CSV file-format is used by spreadsheets and most systems which offer import functionnalities. XML file-format is a modern exchange format, used in soma applications which respect interoperability constraints.<br /><br />When you submit this form, your web browser will automatically offer you to download and save the export-file (it won't be displayed). When you're done, please click the “back” button of your browser.''') form_options = _("Which file format do you want accounts to be exported to? %s") % w.select("type", [ "CSV", "XML"]) data += w.question(_("Please choose file format for export list"), description, yes_values = [ _("Export >>"), "/users/export", "E" ], no_values = [ _("<< Cancel"), "/users/list", "N" ], form_options = form_options) data += '</div><!-- end main -->' return w.page(title, data) else: users.Select(users.FILTER_STANDARD) # TODO: convert this. #req.headers_out["Content-type"] = "application/force-download" #req.headers_out["Content-Disposition"] = "attachment; filename=export.%s" % type.lower() #header("Pragma: no-cache"); #header("Expires: 0"); if type == "CSV": return users.ExportCSV() else: return users.ExportXML()
| 477,929
|
def export(uri, http_user, type = "", yes = None): """ Export user accounts list.""" # TODO: reload(profiles) groups.reload() users.reload() del yes title = _("Export user accounts list") data = '<div id="banner">\n%s\n%s</div>\n%s\n<div id="main">\n%s\n<div id="content"><h1>%s</h1>' % ( w.backto(), w.metanav(http_user), w.menu(uri), ctxtnav(), title) if type == "": description = _('''CSV file-format is used by spreadsheets and most systems which offer import functionnalities. XML file-format is a modern exchange format, used in soma applications which respect interoperability constraints.<br /><br />When you submit this form, your web browser will automatically offer you to download and save the export-file (it won't be displayed). When you're done, please click the “back” button of your browser.''') form_options = _("Which file format do you want accounts to be exported to? %s") % w.select("type", [ "CSV", "XML"]) data += w.question(_("Please choose file format for export list"), description, yes_values = [ _("Export >>"), "/users/export", "E" ], no_values = [ _("<< Cancel"), "/users/list", "N" ], form_options = form_options) data += '</div><!-- end main -->' return w.page(title, data) else: users.Select(users.FILTER_STANDARD) # TODO: convert this. #req.headers_out["Content-type"] = "application/force-download" #req.headers_out["Content-Disposition"] = "attachment; filename=export.%s" % type.lower() #header("Pragma: no-cache"); #header("Expires: 0"); if type == "CSV": return users.ExportCSV() else: return users.ExportXML()
|
def export(uri, http_user, type = "", yes = None): """ Export user accounts list.""" # TODO: reload(profiles) groups.reload() users.reload() del yes title = _("Export user accounts list") data = '<div id="banner">\n%s\n%s</div>\n%s\n<div id="main">\n%s\n<div id="content"><h1>%s</h1>' % ( w.backto(), w.metanav(http_user), w.menu(uri), ctxtnav(), title) if type == "": description = _('''CSV file-format is used by spreadsheets and most systems which offer import functionnalities. XML file-format is a modern exchange format, used in soma applications which respect interoperability constraints.<br /><br />When you submit this form, your web browser will automatically offer you to download and save the export-file (it won't be displayed). When you're done, please click the “back” button of your browser.''') form_options = _("Which file format do you want accounts to be exported to? %s") % w.select("type", [ "CSV", "XML"]) data += w.question(_("Please choose file format for export list"), description, yes_values = [ _("Export >>"), "/users/export", "E" ], no_values = [ _("<< Cancel"), "/users/list", "N" ], form_options = form_options) data += '</div><!-- end main -->' return w.page(title, data) else: users.Select(users.FILTER_STANDARD) # TODO: convert this. #req.headers_out["Content-type"] = "application/force-download" #req.headers_out["Content-Disposition"] = "attachment; filename=export.%s" % type.lower() #header("Pragma: no-cache"); #header("Expires: 0"); if type == "CSV": return users.ExportCSV() else: return users.ExportXML()
| 477,930
|
def export(uri, http_user, type = "", yes = None): """ Export user accounts list.""" # TODO: reload(profiles) groups.reload() users.reload() del yes title = _("Export user accounts list") data = '<div id="banner">\n%s\n%s</div>\n%s\n<div id="main">\n%s\n<div id="content"><h1>%s</h1>' % ( w.backto(), w.metanav(http_user), w.menu(uri), ctxtnav(), title) if type == "": description = _('''CSV file-format is used by spreadsheets and most systems which offer import functionnalities. XML file-format is a modern exchange format, used in soma applications which respect interoperability constraints.<br /><br />When you submit this form, your web browser will automatically offer you to download and save the export-file (it won't be displayed). When you're done, please click the “back” button of your browser.''') form_options = _("Which file format do you want accounts to be exported to? %s") % w.select("type", [ "CSV", "XML"]) data += w.question(_("Please choose file format for export list"), description, yes_values = [ _("Export >>"), "/users/export", "E" ], no_values = [ _("<< Cancel"), "/users/list", "N" ], form_options = form_options) data += '</div><!-- end main -->' return w.page(title, data) else: users.Select(users.FILTER_STANDARD) # TODO: convert this. #req.headers_out["Content-type"] = "application/force-download" #req.headers_out["Content-Disposition"] = "attachment; filename=export.%s" % type.lower() #header("Pragma: no-cache"); #header("Expires: 0"); if type == "CSV": return users.ExportCSV() else: return users.ExportXML()
|
def export(uri, http_user, type = "", yes = None): """ Export user accounts list.""" # TODO: reload(profiles) groups.reload() users.reload() del yes title = _("Export user accounts list") data = '<div id="banner">\n%s\n%s</div>\n%s\n<div id="main">\n%s\n<div id="content"><h1>%s</h1>' % ( w.backto(), w.metanav(http_user), w.menu(uri), ctxtnav(), title) if type == "": description = _('''CSV file-format is used by spreadsheets and most systems which offer import functionnalities. XML file-format is a modern exchange format, used in soma applications which respect interoperability constraints.<br /><br />When you submit this form, your web browser will automatically offer you to download and save the export-file (it won't be displayed). When you're done, please click the “back” button of your browser.''') form_options = _("Which file format do you want accounts to be exported to? %s") % w.select("type", [ "CSV", "XML"]) data += w.question(_("Please choose file format for export list"), description, yes_values = [ _("Export >>"), "/users/export", "E" ], no_values = [ _("<< Cancel"), "/users/list", "N" ], form_options = form_options) data += '</div><!-- end main -->' return w.page(title, data) else: users.Select(users.FILTER_STANDARD) # TODO: convert this. #req.headers_out["Content-type"] = "application/force-download" #req.headers_out["Content-Disposition"] = "attachment; filename=export.%s" % type.lower() #header("Pragma: no-cache"); #header("Expires: 0"); if type == "CSV": return users.ExportCSV() else: return users.ExportXML()
| 477,931
|
def delete(uri, http_user, login, sure = False, no_archive = False, yes = None): """remove user account.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes title = _("Remove user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: data += w.question(_("Are you sure you want to remove account <strong>%s</strong>?") % login, _("""User's <strong>personnal data</strong> (his/her HOME dir) will be <strong>archived</strong> in directory <code>%s</code> and members of group <strong>%s</strong> will be able to access it to operate an eventual recover.<br />However, you can decide to permanently remove it.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove >>"), "/users/delete/%s/sure" % login, _("R") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove account data (no archiving)."), checked = False) ) data += w.page_body_end() return w.page(title, data) else: users.reload() if users.is_system_login(login): return w.page(title, w.error(_("Failed to remove account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ 'sudo', 'del', 'user', '--quiet', '--no-colors', '--login', login ] if no_archive: command.extend(['--no-archive']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to remove account <strong>%s</strong>!") % login))
|
def delete(uri, http_user, login, sure = False, no_archive = False, yes = None): """remove user account.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes title = _("Remove user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: data += w.question(_("Are you sure you want to remove account <strong>%s</strong>?") % login, _("""User's <strong>personnal data</strong> (his/her HOME dir) will be <strong>archived</strong> in directory <code>%s</code> and members of group <strong>%s</strong> will be able to access it to operate an eventual recover.<br />However, you can decide to permanently remove it.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove >>"), "/users/delete/%s/sure" % login, _("R") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove account data (no archiving)."), checked = False) ) data += w.page_body_end() return w.page(title, data) else: users.reload() if users.is_system_login(login): return w.page(title, w.error(_("Failed to remove account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ 'sudo', 'del', 'user', '--quiet', '--no-colors', '--login', login ] if no_archive: command.extend(['--no-archive']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to remove account <strong>%s</strong>!") % login))
| 477,932
|
def delete(uri, http_user, login, sure = False, no_archive = False, yes = None): """remove user account.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes title = _("Remove user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: data += w.question(_("Are you sure you want to remove account <strong>%s</strong>?") % login, _("""User's <strong>personnal data</strong> (his/her HOME dir) will be <strong>archived</strong> in directory <code>%s</code> and members of group <strong>%s</strong> will be able to access it to operate an eventual recover.<br />However, you can decide to permanently remove it.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove >>"), "/users/delete/%s/sure" % login, _("R") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove account data (no archiving)."), checked = False) ) data += w.page_body_end() return w.page(title, data) else: users.reload() if users.is_system_login(login): return w.page(title, w.error(_("Failed to remove account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ 'sudo', 'del', 'user', '--quiet', '--no-colors', '--login', login ] if no_archive: command.extend(['--no-archive']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to remove account <strong>%s</strong>!") % login))
|
def delete(uri, http_user, login, sure = False, no_archive = False, yes = None): """remove user account.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes title = _("Remove user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: data += w.question(_("Are you sure you want to remove account <strong>%s</strong>?") % login, _("""User's <strong>personnal data</strong> (his/her HOME dir) will be <strong>archived</strong> in directory <code>%s</code> and members of group <strong>%s</strong> will be able to access it to operate an eventual recover.<br />However, you can decide to permanently remove it.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove >>"), "/users/delete/%s/sure" % login, _("R") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove account data (no archiving)."), checked = False) ) data += w.page_body_end() return w.page(title, data) else: users.reload() if users.is_system_login(login): return w.page(title, w.error(_("Failed to remove account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ 'sudo', 'del', 'user', '--quiet', '--no-colors', '--login', login ] if no_archive: command.extend(['--no-archive']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to remove account <strong>%s</strong>!") % login))
| 477,933
|
def delete(uri, http_user, login, sure = False, no_archive = False, yes = None): """remove user account.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes title = _("Remove user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: data += w.question(_("Are you sure you want to remove account <strong>%s</strong>?") % login, _("""User's <strong>personnal data</strong> (his/her HOME dir) will be <strong>archived</strong> in directory <code>%s</code> and members of group <strong>%s</strong> will be able to access it to operate an eventual recover.<br />However, you can decide to permanently remove it.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove >>"), "/users/delete/%s/sure" % login, _("R") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove account data (no archiving)."), checked = False) ) data += w.page_body_end() return w.page(title, data) else: users.reload() if users.is_system_login(login): return w.page(title, w.error(_("Failed to remove account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ 'sudo', 'del', 'user', '--quiet', '--no-colors', '--login', login ] if no_archive: command.extend(['--no-archive']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to remove account <strong>%s</strong>!") % login))
|
def delete(uri, http_user, login, sure = False, no_archive = False, yes = None): """remove user account.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes title = _("Remove user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: data += w.question(_("Are you sure you want to remove account <strong>%s</strong>?") % login, _("""User's <strong>personnal data</strong> (his/her HOME dir) will be <strong>archived</strong> in directory <code>%s</code> and members of group <strong>%s</strong> will be able to access it to operate an eventual recover.<br />However, you can decide to permanently remove it.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove >>"), "/users/delete/%s/sure" % login, _("R") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove account data (no archiving)."), checked = False) ) data += w.page_body_end() return w.page(title, data) else: users.reload() if users.is_system_login(login): return w.page(title, w.error(_("Failed to remove account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ 'sudo', 'del', 'user', '--quiet', '--no-colors', '--login', login ] if no_archive: command.extend(['--no-archive']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to remove account <strong>%s</strong>!") % login))
| 477,934
|
def delete(uri, http_user, login, sure = False, no_archive = False, yes = None): """remove user account.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes title = _("Remove user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: data += w.question(_("Are you sure you want to remove account <strong>%s</strong>?") % login, _("""User's <strong>personnal data</strong> (his/her HOME dir) will be <strong>archived</strong> in directory <code>%s</code> and members of group <strong>%s</strong> will be able to access it to operate an eventual recover.<br />However, you can decide to permanently remove it.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove >>"), "/users/delete/%s/sure" % login, _("R") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove account data (no archiving)."), checked = False) ) data += w.page_body_end() return w.page(title, data) else: users.reload() if users.is_system_login(login): return w.page(title, w.error(_("Failed to remove account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ 'sudo', 'del', 'user', '--quiet', '--no-colors', '--login', login ] if no_archive: command.extend(['--no-archive']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to remove account <strong>%s</strong>!") % login))
|
def delete(uri, http_user, login, sure = False, no_archive = False, yes = None): """remove user account.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes title = _("Remove user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: data += w.question(_("Are you sure you want to remove account <strong>%s</strong>?") % login, _("""User's <strong>personnal data</strong> (his/her HOME dir) will be <strong>archived</strong> in directory <code>%s</code> and members of group <strong>%s</strong> will be able to access it to operate an eventual recover.<br />However, you can decide to permanently remove it.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove >>"), "/users/delete/%s/sure" % login, _("R") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove account data (no archiving)."), checked = False) ) data += w.page_body_end() return w.page(title, data) else: users.reload() if users.is_system_login(login): return w.page(title, w.error(_("Failed to remove account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ 'sudo', 'del', 'user', '--quiet', '--no-colors', '--login', login ] if no_archive: command.extend(['--no-archive']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to remove account <strong>%s</strong>!") % login))
| 477,935
|
def delete(uri, http_user, login, sure = False, no_archive = False, yes = None): """remove user account.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes title = _("Remove user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: data += w.question(_("Are you sure you want to remove account <strong>%s</strong>?") % login, _("""User's <strong>personnal data</strong> (his/her HOME dir) will be <strong>archived</strong> in directory <code>%s</code> and members of group <strong>%s</strong> will be able to access it to operate an eventual recover.<br />However, you can decide to permanently remove it.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove >>"), "/users/delete/%s/sure" % login, _("R") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove account data (no archiving)."), checked = False) ) data += w.page_body_end() return w.page(title, data) else: users.reload() if users.is_system_login(login): return w.page(title, w.error(_("Failed to remove account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ 'sudo', 'del', 'user', '--quiet', '--no-colors', '--login', login ] if no_archive: command.extend(['--no-archive']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to remove account <strong>%s</strong>!") % login))
|
def delete(uri, http_user, login, sure = False, no_archive = False, yes = None): """remove user account.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes title = _("Remove user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: data += w.question(_("Are you sure you want to remove account <strong>%s</strong>?") % login, _("""User's <strong>personnal data</strong> (his/her HOME dir) will be <strong>archived</strong> in directory <code>%s</code> and members of group <strong>%s</strong> will be able to access it to operate an eventual recover.<br />However, you can decide to permanently remove it.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove >>"), "/users/delete/%s/sure" % login, _("R") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove account data (no archiving)."), checked = False) ) data += w.page_body_end() return w.page(title, data) else: users.reload() if users.is_system_login(login): return w.page(title, w.error(_("Failed to remove account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ 'sudo', 'del', 'user', '--quiet', '--no-colors', '--login', login ] if no_archive: command.extend(['--no-archive']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to remove account <strong>%s</strong>!") % login))
| 477,936
|
def unlock(uri, http_user, login): """unlock a user account password.""" title = _("Unlock account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) users.reload() data += w.page_body_end() if users.is_system_login(login): return w.page(title, w.error(_("Failed to unlock account"), [ _("alter system account.") ], _("insufficient permission to perform operation."))) command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, "--unlock" ] return w.page(title, data + w.run(command, uri, err_msg = _("Failed to unlock account <strong>%s</strong>!") % login))
|
def unlock(uri, http_user, login): """unlock a user account password.""" title = _("Unlock account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) users.reload() data += w.page_body_end() if users.is_system_login(login): return w.page(title, w.error(_("Failed to unlock account"), [ _("alter system account.") ], _("insufficient permission to perform operation."))) command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, "--unlock" ] return w.page(title, data + w.run(command, uri, err_msg = _("Failed to unlock account <strong>%s</strong>!") % login))
| 477,937
|
def lock(uri, http_user, login, sure = False, remove_remotessh = False, yes = None): """lock a user account password.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes groups.reload() users.reload() title = _("Lock account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: description = _('''This will prevent user to connect to network clients (thin ones, and Windows®, %s/Linux® and Macintosh® ones).''') % w.acr('GNU') # TODO: Vérifier que le groupe "remotessh" existe bien sur le système... if login in groups.all_members('remotessh'): description += _("""<br /><br /> But this will not block incoming %s network connections, if the user uses %s %s or %s public/private keys. To block ANY access to the system, <strong>remove him/her from remotessh group</strong>.""") % (w.acr('SSH'), w.acr('SSH'), w.acr('RSA'), w.acr('DSA')) form_options = w.checkbox("remove_remotessh", "True", _("Remove user from group <code>remotessh</code> in the same time."), checked = True, accesskey = _('R')) else: form_options = None data += w.question(_("Are you sure you want to lock account <strong>%s</strong>?") % login, description, yes_values = [ _("Lock >>"), "/users/lock/%s/sure" % login, _("L") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: if users.is_system_login(login): return w.page(title, w.error(_("Failed to lock account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, "--lock" ] if remove_remotessh: command.extend(['--del-groups', 'remotessh']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to lock account <strong>%s</strong>!") % login))
|
def lock(uri, http_user, login, sure = False, remove_remotessh = False, yes = None): """lock a user account password.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes groups.reload() users.reload() title = _("Lock account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: description = _('''This will prevent user to connect to network clients (thin ones, and Windows®, %s/Linux® and Macintosh® ones).''') % w.acr('GNU') # TODO: Vérifier que le groupe "remotessh" existe bien sur le système... if login in groups.all_members('remotessh'): description += _("""<br /><br /> But this will not block incoming %s network connections, if the user uses %s %s or %s public/private keys. To block ANY access to the system, <strong>remove him/her from remotessh group</strong>.""") % (w.acr('SSH'), w.acr('SSH'), w.acr('RSA'), w.acr('DSA')) form_options = w.checkbox("remove_remotessh", "True", _("Remove user from group <code>remotessh</code> in the same time."), checked = True, accesskey = _('R')) else: form_options = None data += w.question(_("Are you sure you want to lock account <strong>%s</strong>?") % login, description, yes_values = [ _("Lock >>"), "/users/lock/%s/sure" % login, _("L") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: if users.is_system_login(login): return w.page(title, w.error(_("Failed to lock account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, "--lock" ] if remove_remotessh: command.extend(['--del-groups', 'remotessh']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to lock account <strong>%s</strong>!") % login))
| 477,938
|
def lock(uri, http_user, login, sure = False, remove_remotessh = False, yes = None): """lock a user account password.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes groups.reload() users.reload() title = _("Lock account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: description = _('''This will prevent user to connect to network clients (thin ones, and Windows®, %s/Linux® and Macintosh® ones).''') % w.acr('GNU') # TODO: Vérifier que le groupe "remotessh" existe bien sur le système... if login in groups.all_members('remotessh'): description += _("""<br /><br /> But this will not block incoming %s network connections, if the user uses %s %s or %s public/private keys. To block ANY access to the system, <strong>remove him/her from remotessh group</strong>.""") % (w.acr('SSH'), w.acr('SSH'), w.acr('RSA'), w.acr('DSA')) form_options = w.checkbox("remove_remotessh", "True", _("Remove user from group <code>remotessh</code> in the same time."), checked = True, accesskey = _('R')) else: form_options = None data += w.question(_("Are you sure you want to lock account <strong>%s</strong>?") % login, description, yes_values = [ _("Lock >>"), "/users/lock/%s/sure" % login, _("L") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: if users.is_system_login(login): return w.page(title, w.error(_("Failed to lock account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, "--lock" ] if remove_remotessh: command.extend(['--del-groups', 'remotessh']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to lock account <strong>%s</strong>!") % login))
|
def lock(uri, http_user, login, sure = False, remove_remotessh = False, yes = None): """lock a user account password.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes groups.reload() users.reload() title = _("Lock account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: description = _('''This will prevent user to connect to network clients (thin ones, and Windows®, %s/Linux® and Macintosh® ones).''') % w.acr('GNU') # TODO: Vérifier que le groupe "remotessh" existe bien sur le système... if login in groups.all_members('remotessh'): description += _("""<br /><br /> But this will not block incoming %s network connections, if the user uses %s %s or %s public/private keys. To block ANY access to the system, <strong>remove him/her from remotessh group</strong>.""") % (w.acr('SSH'), w.acr('SSH'), w.acr('RSA'), w.acr('DSA')) form_options = w.checkbox("remove_remotessh", "True", _("Remove user from group <code>remotessh</code> in the same time."), checked = True, accesskey = _('R')) else: form_options = None data += w.question(_("Are you sure you want to lock account <strong>%s</strong>?") % login, description, yes_values = [ _("Lock >>"), "/users/lock/%s/sure" % login, _("L") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: if users.is_system_login(login): return w.page(title, w.error(_("Failed to lock account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, "--lock" ] if remove_remotessh: command.extend(['--del-groups', 'remotessh']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to lock account <strong>%s</strong>!") % login))
| 477,939
|
def lock(uri, http_user, login, sure = False, remove_remotessh = False, yes = None): """lock a user account password.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes groups.reload() users.reload() title = _("Lock account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: description = _('''This will prevent user to connect to network clients (thin ones, and Windows®, %s/Linux® and Macintosh® ones).''') % w.acr('GNU') # TODO: Vérifier que le groupe "remotessh" existe bien sur le système... if login in groups.all_members('remotessh'): description += _("""<br /><br /> But this will not block incoming %s network connections, if the user uses %s %s or %s public/private keys. To block ANY access to the system, <strong>remove him/her from remotessh group</strong>.""") % (w.acr('SSH'), w.acr('SSH'), w.acr('RSA'), w.acr('DSA')) form_options = w.checkbox("remove_remotessh", "True", _("Remove user from group <code>remotessh</code> in the same time."), checked = True, accesskey = _('R')) else: form_options = None data += w.question(_("Are you sure you want to lock account <strong>%s</strong>?") % login, description, yes_values = [ _("Lock >>"), "/users/lock/%s/sure" % login, _("L") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: if users.is_system_login(login): return w.page(title, w.error(_("Failed to lock account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, "--lock" ] if remove_remotessh: command.extend(['--del-groups', 'remotessh']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to lock account <strong>%s</strong>!") % login))
|
def lock(uri, http_user, login, sure = False, remove_remotessh = False, yes = None): """lock a user account password.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes groups.reload() users.reload() title = _("Lock account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: description = _('''This will prevent user to connect to network clients (thin ones, and Windows®, %s/Linux® and Macintosh® ones).''') % w.acr('GNU') # TODO: Vérifier que le groupe "remotessh" existe bien sur le système... if login in groups.all_members('remotessh'): description += _("""<br /><br /> But this will not block incoming %s network connections, if the user uses %s %s or %s public/private keys. To block ANY access to the system, <strong>remove him/her from remotessh group</strong>.""") % (w.acr('SSH'), w.acr('SSH'), w.acr('RSA'), w.acr('DSA')) form_options = w.checkbox("remove_remotessh", "True", _("Remove user from group <code>remotessh</code> in the same time."), checked = True, accesskey = _('R')) else: form_options = None data += w.question(_("Are you sure you want to lock account <strong>%s</strong>?") % login, description, yes_values = [ _("Lock >>"), "/users/lock/%s/sure" % login, _("L") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: if users.is_system_login(login): return w.page(title, w.error(_("Failed to lock account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, "--lock" ] if remove_remotessh: command.extend(['--del-groups', 'remotessh']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to lock account <strong>%s</strong>!") % login))
| 477,940
|
def lock(uri, http_user, login, sure = False, remove_remotessh = False, yes = None): """lock a user account password.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes groups.reload() users.reload() title = _("Lock account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: description = _('''This will prevent user to connect to network clients (thin ones, and Windows®, %s/Linux® and Macintosh® ones).''') % w.acr('GNU') # TODO: Vérifier que le groupe "remotessh" existe bien sur le système... if login in groups.all_members('remotessh'): description += _("""<br /><br /> But this will not block incoming %s network connections, if the user uses %s %s or %s public/private keys. To block ANY access to the system, <strong>remove him/her from remotessh group</strong>.""") % (w.acr('SSH'), w.acr('SSH'), w.acr('RSA'), w.acr('DSA')) form_options = w.checkbox("remove_remotessh", "True", _("Remove user from group <code>remotessh</code> in the same time."), checked = True, accesskey = _('R')) else: form_options = None data += w.question(_("Are you sure you want to lock account <strong>%s</strong>?") % login, description, yes_values = [ _("Lock >>"), "/users/lock/%s/sure" % login, _("L") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: if users.is_system_login(login): return w.page(title, w.error(_("Failed to lock account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, "--lock" ] if remove_remotessh: command.extend(['--del-groups', 'remotessh']) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to lock account <strong>%s</strong>!") % login))
|
def lock(uri, http_user, login, sure = False, remove_remotessh = False, yes = None): """lock a user account password.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes groups.reload() users.reload() title = _("Lock account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if not sure: description = _('''This will prevent user to connect to network clients (thin ones, and Windows®, %s/Linux® and Macintosh® ones).''') % w.acr('GNU') # TODO: Vérifier que le groupe "remotessh" existe bien sur le système... if login in groups.all_members('remotessh'): description += _("""<br /><br /> But this will not block incoming %s network connections, if the user uses %s %s or %s public/private keys. To block ANY access to the system, <strong>remove him/her from remotessh group</strong>.""") % (w.acr('SSH'), w.acr('SSH'), w.acr('RSA'), w.acr('DSA')) form_options = w.checkbox("remove_remotessh", "True", _("Remove user from group <code>remotessh</code> in the same time."), checked = True, accesskey = _('R')) else: form_options = None data += w.question(_("Are you sure you want to lock account <strong>%s</strong>?") % login, description, yes_values = [ _("Lock >>"), "/users/lock/%s/sure" % login, _("L") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: if users.is_system_login(login): return w.page(title, w.error(_("Failed to lock account"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, "--lock" ] if configuration.ssh.enabled and remove_remotessh: command.extend(['--del-groups', configuration.ssh.group]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to lock account <strong>%s</strong>!") % login))
| 477,941
|
def skel(uri, http_user, login, sure = False, apply_skel = configuration.users.default_skel, yes = None): """reapply a user's skel with confirmation.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes # TODO: profiles.reload() groups.reload() users.reload() u = users.users g = groups.groups title = _("Reapply skel to user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if users.is_system_login(login): return w.page(title, w.error(_("Failed to reapply skel"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) if not sure: description = _('''This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.''') pri_group = g[u[users.login_to_uid(login)]['gid']]['name'] # liste des skels du profile en cours. def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list form_options = _("Which skel do you want to apply? %s") % w.select("apply_skel", filter_skels(pri_group, configuration.users.skels), func = os.path.basename) data += w.question(_("Are you sure you want to apply this skel to account <strong>%s</strong>?") % login, description, yes_values = [ _("Apply >>"), "/users/skel/%s/sure" % login, _("A") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, '--apply-skel', apply_skel ] data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to apply skel <strong>%s</strong> on user account <strong>%s</strong>!") % (os.path.basename(apply_skel), login)))
|
def skel(uri, http_user, login, sure = False, apply_skel = configuration.users.default_skel, yes = None): """reapply a user's skel with confirmation.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes # TODO: profiles.reload() groups.reload() users.reload() u = users.users g = groups.groups title = _("Reapply skel to user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if users.is_system_login(login): return w.page(title, w.error(_("Failed to reapply skel"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) if not sure: description = _('''This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.''') pri_group = g[u[users.login_to_uid(login)]['gid']]['name'] # liste des skels du profile en cours. def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list form_options = _("Which skel do you want to apply? %s") % w.select("apply_skel", filter_skels(pri_group, configuration.users.skels), func = os.path.basename) data += w.question(_("Are you sure you want to apply this skel to account <strong>%s</strong>?") % login, description, yes_values = [ _("Apply >>"), "/users/skel/%s/sure" % login, _("A") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, '--apply-skel', apply_skel ] data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to apply skel <strong>%s</strong> on user account <strong>%s</strong>!") % (os.path.basename(apply_skel), login)))
| 477,942
|
def skel(uri, http_user, login, sure = False, apply_skel = configuration.users.default_skel, yes = None): """reapply a user's skel with confirmation.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes # TODO: profiles.reload() groups.reload() users.reload() u = users.users g = groups.groups title = _("Reapply skel to user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if users.is_system_login(login): return w.page(title, w.error(_("Failed to reapply skel"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) if not sure: description = _('''This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.''') pri_group = g[u[users.login_to_uid(login)]['gid']]['name'] # liste des skels du profile en cours. def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list form_options = _("Which skel do you want to apply? %s") % w.select("apply_skel", filter_skels(pri_group, configuration.users.skels), func = os.path.basename) data += w.question(_("Are you sure you want to apply this skel to account <strong>%s</strong>?") % login, description, yes_values = [ _("Apply >>"), "/users/skel/%s/sure" % login, _("A") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, '--apply-skel', apply_skel ] data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to apply skel <strong>%s</strong> on user account <strong>%s</strong>!") % (os.path.basename(apply_skel), login)))
|
def skel(uri, http_user, login, sure = False, apply_skel = configuration.users.default_skel, yes = None): """reapply a user's skel with confirmation.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes # TODO: profiles.reload() groups.reload() users.reload() u = users.users g = groups.groups title = _("Reapply skel to user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if users.is_system_login(login): return w.page(title, w.error(_("Failed to reapply skel"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) if not sure: description = _('''This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.''') pri_group = g[u[users.login_to_uid(login)]['gid']]['name'] # liste des skels du profile en cours. def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list form_options = _("Which skel do you want to apply? %s") % w.select("apply_skel", filter_skels(pri_group, configuration.users.skels), func = os.path.basename) data += w.question(_("Are you sure you want to apply this skel to account <strong>%s</strong>?") % login, description, yes_values = [ _("Apply >>"), "/users/skel/%s/sure" % login, _("A") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, '--apply-skel', apply_skel ] data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to apply skel <strong>%s</strong> on user account <strong>%s</strong>!") % (os.path.basename(apply_skel), login)))
| 477,943
|
def skel(uri, http_user, login, sure = False, apply_skel = configuration.users.default_skel, yes = None): """reapply a user's skel with confirmation.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes # TODO: profiles.reload() groups.reload() users.reload() u = users.users g = groups.groups title = _("Reapply skel to user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if users.is_system_login(login): return w.page(title, w.error(_("Failed to reapply skel"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) if not sure: description = _('''This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.''') pri_group = g[u[users.login_to_uid(login)]['gid']]['name'] # liste des skels du profile en cours. def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list form_options = _("Which skel do you want to apply? %s") % w.select("apply_skel", filter_skels(pri_group, configuration.users.skels), func = os.path.basename) data += w.question(_("Are you sure you want to apply this skel to account <strong>%s</strong>?") % login, description, yes_values = [ _("Apply >>"), "/users/skel/%s/sure" % login, _("A") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, '--apply-skel', apply_skel ] data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to apply skel <strong>%s</strong> on user account <strong>%s</strong>!") % (os.path.basename(apply_skel), login)))
|
def skel(uri, http_user, login, sure = False, apply_skel = configuration.users.default_skel, yes = None): """reapply a user's skel with confirmation.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes # TODO: profiles.reload() groups.reload() users.reload() u = users.users g = groups.groups title = _("Reapply skel to user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if users.is_system_login(login): return w.page(title, w.error(_("Failed to reapply skel"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) if not sure: description = _('''This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.''') pri_group = g[u[users.login_to_uid(login)]['gid']]['name'] # liste des skels du profile en cours. def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list form_options = _("Which skel do you want to apply? %s") % w.select("apply_skel", filter_skels(pri_group, configuration.users.skels), func = os.path.basename) data += w.question(_("Are you sure you want to apply this skel to account <strong>%s</strong>?") % login, description, yes_values = [ _("Apply >>"), "/users/skel/%s/sure" % login, _("A") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, '--apply-skel', apply_skel ] data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to apply skel <strong>%s</strong> on user account <strong>%s</strong>!") % (os.path.basename(apply_skel), login)))
| 477,944
|
def skel(uri, http_user, login, sure = False, apply_skel = configuration.users.default_skel, yes = None): """reapply a user's skel with confirmation.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes # TODO: profiles.reload() groups.reload() users.reload() u = users.users g = groups.groups title = _("Reapply skel to user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if users.is_system_login(login): return w.page(title, w.error(_("Failed to reapply skel"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) if not sure: description = _('''This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.''') pri_group = g[u[users.login_to_uid(login)]['gid']]['name'] # liste des skels du profile en cours. def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list form_options = _("Which skel do you want to apply? %s") % w.select("apply_skel", filter_skels(pri_group, configuration.users.skels), func = os.path.basename) data += w.question(_("Are you sure you want to apply this skel to account <strong>%s</strong>?") % login, description, yes_values = [ _("Apply >>"), "/users/skel/%s/sure" % login, _("A") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, '--apply-skel', apply_skel ] data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to apply skel <strong>%s</strong> on user account <strong>%s</strong>!") % (os.path.basename(apply_skel), login)))
|
def skel(uri, http_user, login, sure = False, apply_skel = configuration.users.default_skel, yes = None): """reapply a user's skel with confirmation.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del yes # TODO: profiles.reload() groups.reload() users.reload() u = users.users g = groups.groups title = _("Reapply skel to user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title) if users.is_system_login(login): return w.page(title, w.error(_("Failed to reapply skel"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) if not sure: description = _('''This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.''') pri_group = g[u[users.login_to_uid(login)]['gid']]['name'] # liste des skels du profile en cours. def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list form_options = _("Which skel do you want to apply? %s") % w.select("apply_skel", filter_skels(pri_group, configuration.users.skels), func = os.path.basename) data += w.question(_("Are you sure you want to apply this skel to account <strong>%s</strong>?") % login, description, yes_values = [ _("Apply >>"), "/users/skel/%s/sure" % login, _("A") ], no_values = [ _("<< Cancel"), "/users/list", _("C") ], form_options = form_options) data += w.page_body_end() return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, '--apply-skel', apply_skel ] data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _("Failed to apply skel <strong>%s</strong> on user account <strong>%s</strong>!") % (os.path.basename(apply_skel), login)))
| 477,945
|
def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list
|
def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list
| 477,946
|
def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list
|
def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list
| 477,947
|
def new(uri, http_user): """Generate a form to create a new user on the system.""" # TODO: profiles.reload() groups.reload() g = groups.groups p = profiles.profiles title = _("New user account") data = w.page_body_start(uri, http_user, ctxtnav, title, False) def profile_input(): #TODO: To be rewritten ? return """ <tr> <td><strong>%s</strong></td> <td class="right">
|
def new(uri, http_user): """Generate a form to create a new user on the system.""" # TODO: profiles.reload() groups.reload() g = groups.groups p = profiles.profiles title = _("New user account") data = w.page_body_start(uri, http_user, ctxtnav, title, False) def profile_input(): #TODO: To be rewritten ? return """ <tr> <td><strong>%s</strong></td> <td class="right">
| 477,948
|
def new(uri, http_user): """Generate a form to create a new user on the system.""" # TODO: profiles.reload() groups.reload() g = groups.groups p = profiles.profiles title = _("New user account") data = w.page_body_start(uri, http_user, ctxtnav, title, False) def profile_input(): #TODO: To be rewritten ? return """ <tr> <td><strong>%s</strong></td> <td class="right">
|
def new(uri, http_user): """Generate a form to create a new user on the system.""" # TODO: profiles.reload() groups.reload() g = groups.groups p = profiles.profiles title = _("New user account") data = w.page_body_start(uri, http_user, ctxtnav, title, False) def profile_input(): #TODO: To be rewritten ? return """ <tr> <td><strong>%s</strong></td> <td class="right">
| 477,949
|
def create(uri, http_user, loginShell, password, password_confirm, profile = None, login = "", gecos = "", firstname = "", lastname = "", standard_groups_dest = [], privileged_groups_dest = [], responsible_groups_dest = [], guest_groups_dest = [], standard_groups_source = [], privileged_groups_source = [], responsible_groups_source = [], guest_groups_source = [], create = None ): # forget about it, this is a scoria from the POST FORM to variable conversion. del create title = _("New user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("Password must be at least %d characters long!%s") % (configuration.mAutoPasswdSize, rewind))) command = [ "sudo", "add", "user", '--quiet', '--no-colors', '--password', password ] if firstname != '' and lastname != '': command.extend(['--firstname', firstname, '--lastname', lastname]) if gecos != '': command.extend(['--gecos', gecos]) # TODO: set a default profile (see issue #6) if profile != None: command.extend([ "--profile", profile ]) if login != "": command.extend([ "--login", login ]) else: # TODO: Idem, "gecos" should be tested against emptyness command.extend([ '--login', hlstr.validate_name(gecos).replace('_', '.').rstrip('.') ]) retval = w.run(command, uri, err_msg = _('Failed to create account <strong>%s</strong>!') % login) # TODO: Change test since message received: Added user <login> if retval != "": return w.page(title, data + retval) # XXX: this is less than suboptimal to have to do this here... # but without this, adding to supplemental groups doesnt work. users.reload() command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to add user <strong>%s</strong> to requested groups/privileges/responsibilities/invitations!') % login))
|
def create(uri, http_user, loginShell, password, password_confirm, profile = None, login = "", gecos = "", firstname = "", lastname = "", standard_groups_dest = [], privileged_groups_dest = [], responsible_groups_dest = [], guest_groups_dest = [], standard_groups_source = [], privileged_groups_source = [], responsible_groups_source = [], guest_groups_source = [], create = None ): # forget about it, this is a scoria from the POST FORM to variable conversion. del create title = _("New user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("Password must be at least %d characters long!%s") % (configuration.mAutoPasswdSize, rewind))) command = [ "sudo", "add", "user", '--quiet', '--no-colors', '--password', password ] if firstname != '' and lastname != '': command.extend(['--firstname', firstname, '--lastname', lastname]) if gecos != '': command.extend(['--gecos', gecos]) # TODO: set a default profile (see issue #6) if profile != None: command.extend([ "--profile", profile ]) if login != "": command.extend([ "--login", login ]) else: # TODO: Idem, "gecos" should be tested against emptyness command.extend([ '--login', hlstr.validate_name(gecos).replace('_', '.').rstrip('.') ]) retval = w.run(command, uri, err_msg = _('Failed to create account <strong>%s</strong>!') % login) # TODO: Change test since message received: Added user <login> if retval != "": return w.page(title, data + retval) # XXX: this is less than suboptimal to have to do this here... # but without this, adding to supplemental groups doesnt work. users.reload() command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to add user <strong>%s</strong> to requested groups/privileges/responsibilities/invitations!') % login))
| 477,950
|
def create(uri, http_user, loginShell, password, password_confirm, profile = None, login = "", gecos = "", firstname = "", lastname = "", standard_groups_dest = [], privileged_groups_dest = [], responsible_groups_dest = [], guest_groups_dest = [], standard_groups_source = [], privileged_groups_source = [], responsible_groups_source = [], guest_groups_source = [], create = None ): # forget about it, this is a scoria from the POST FORM to variable conversion. del create title = _("New user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("Password must be at least %d characters long!%s") % (configuration.mAutoPasswdSize, rewind))) command = [ "sudo", "add", "user", '--quiet', '--no-colors', '--password', password ] if firstname != '' and lastname != '': command.extend(['--firstname', firstname, '--lastname', lastname]) if gecos != '': command.extend(['--gecos', gecos]) # TODO: set a default profile (see issue #6) if profile != None: command.extend([ "--profile", profile ]) if login != "": command.extend([ "--login", login ]) else: # TODO: Idem, "gecos" should be tested against emptyness command.extend([ '--login', hlstr.validate_name(gecos).replace('_', '.').rstrip('.') ]) retval = w.run(command, uri, err_msg = _('Failed to create account <strong>%s</strong>!') % login) # TODO: Change test since message received: Added user <login> if retval != "": return w.page(title, data + retval) # XXX: this is less than suboptimal to have to do this here... # but without this, adding to supplemental groups doesnt work. users.reload() command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to add user <strong>%s</strong> to requested groups/privileges/responsibilities/invitations!') % login))
|
def create(uri, http_user, loginShell, password, password_confirm, profile = None, login = "", gecos = "", firstname = "", lastname = "", standard_groups_dest = [], privileged_groups_dest = [], responsible_groups_dest = [], guest_groups_dest = [], standard_groups_source = [], privileged_groups_source = [], responsible_groups_source = [], guest_groups_source = [], create = None ): # forget about it, this is a scoria from the POST FORM to variable conversion. del create title = _("New user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("Password must be at least %d characters long!%s") % (configuration.mAutoPasswdSize, rewind))) command = [ "sudo", "add", "user", '--quiet', '--no-colors', '--password', password ] if firstname != '' and lastname != '': command.extend(['--firstname', firstname, '--lastname', lastname]) if gecos != '': command.extend(['--gecos', gecos]) # TODO: set a default profile (see issue #6) if profile != None: command.extend([ "--profile", profile ]) if login != "": command.extend([ "--login", login ]) else: # TODO: Idem, "gecos" should be tested against emptyness command.extend([ '--login', hlstr.validate_name(gecos).replace('_', '.').rstrip('.') ]) retval = w.run(command, uri, err_msg = _('Failed to create account <strong>%s</strong>!') % login) # TODO: Change test since message received: Added user <login> if retval != "": return w.page(title, data + retval) # XXX: this is less than suboptimal to have to do this here... # but without this, adding to supplemental groups doesnt work. users.reload() command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to add user <strong>%s</strong> to requested groups/privileges/responsibilities/invitations!') % login))
| 477,951
|
def create(uri, http_user, loginShell, password, password_confirm, profile = None, login = "", gecos = "", firstname = "", lastname = "", standard_groups_dest = [], privileged_groups_dest = [], responsible_groups_dest = [], guest_groups_dest = [], standard_groups_source = [], privileged_groups_source = [], responsible_groups_source = [], guest_groups_source = [], create = None ): # forget about it, this is a scoria from the POST FORM to variable conversion. del create title = _("New user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("Password must be at least %d characters long!%s") % (configuration.mAutoPasswdSize, rewind))) command = [ "sudo", "add", "user", '--quiet', '--no-colors', '--password', password ] if firstname != '' and lastname != '': command.extend(['--firstname', firstname, '--lastname', lastname]) if gecos != '': command.extend(['--gecos', gecos]) # TODO: set a default profile (see issue #6) if profile != None: command.extend([ "--profile", profile ]) if login != "": command.extend([ "--login", login ]) else: # TODO: Idem, "gecos" should be tested against emptyness command.extend([ '--login', hlstr.validate_name(gecos).replace('_', '.').rstrip('.') ]) retval = w.run(command, uri, err_msg = _('Failed to create account <strong>%s</strong>!') % login) # TODO: Change test since message received: Added user <login> if retval != "": return w.page(title, data + retval) # XXX: this is less than suboptimal to have to do this here... # but without this, adding to supplemental groups doesnt work. users.reload() command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to add user <strong>%s</strong> to requested groups/privileges/responsibilities/invitations!') % login))
|
def create(uri, http_user, loginShell, password, password_confirm, profile = None, login = "", gecos = "", firstname = "", lastname = "", standard_groups_dest = [], privileged_groups_dest = [], responsible_groups_dest = [], guest_groups_dest = [], standard_groups_source = [], privileged_groups_source = [], responsible_groups_source = [], guest_groups_source = [], create = None ): # forget about it, this is a scoria from the POST FORM to variable conversion. del create title = _("New user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("Password must be at least %d characters long!%s") % (configuration.mAutoPasswdSize, rewind))) command = [ "sudo", "add", "user", '--quiet', '--no-colors', '--password', password ] if firstname != '' and lastname != '': command.extend(['--firstname', firstname, '--lastname', lastname]) if gecos != '': command.extend(['--gecos', gecos]) # TODO: set a default profile (see issue #6) if profile != None: command.extend([ "--profile", profile ]) if login != "": command.extend([ "--login", login ]) else: # TODO: Idem, "gecos" should be tested against emptyness command.extend([ '--login', hlstr.validate_name(gecos).replace('_', '.').rstrip('.') ]) retval = w.run(command, uri, err_msg = _('Failed to create account <strong>%s</strong>!') % login) # TODO: Change test since message received: Added user <login> if retval != "": return w.page(title, data + retval) # XXX: this is less than suboptimal to have to do this here... # but without this, adding to supplemental groups doesnt work. users.reload() command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to add user <strong>%s</strong> to requested groups/privileges/responsibilities/invitations!') % login))
| 477,952
|
def create(uri, http_user, loginShell, password, password_confirm, profile = None, login = "", gecos = "", firstname = "", lastname = "", standard_groups_dest = [], privileged_groups_dest = [], responsible_groups_dest = [], guest_groups_dest = [], standard_groups_source = [], privileged_groups_source = [], responsible_groups_source = [], guest_groups_source = [], create = None ): # forget about it, this is a scoria from the POST FORM to variable conversion. del create title = _("New user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("Password must be at least %d characters long!%s") % (configuration.mAutoPasswdSize, rewind))) command = [ "sudo", "add", "user", '--quiet', '--no-colors', '--password', password ] if firstname != '' and lastname != '': command.extend(['--firstname', firstname, '--lastname', lastname]) if gecos != '': command.extend(['--gecos', gecos]) # TODO: set a default profile (see issue #6) if profile != None: command.extend([ "--profile", profile ]) if login != "": command.extend([ "--login", login ]) else: # TODO: Idem, "gecos" should be tested against emptyness command.extend([ '--login', hlstr.validate_name(gecos).replace('_', '.').rstrip('.') ]) retval = w.run(command, uri, err_msg = _('Failed to create account <strong>%s</strong>!') % login) # TODO: Change test since message received: Added user <login> if retval != "": return w.page(title, data + retval) # XXX: this is less than suboptimal to have to do this here... # but without this, adding to supplemental groups doesnt work. users.reload() command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to add user <strong>%s</strong> to requested groups/privileges/responsibilities/invitations!') % login))
|
def create(uri, http_user, loginShell, password, password_confirm, profile = None, login = "", gecos = "", firstname = "", lastname = "", standard_groups_dest = [], privileged_groups_dest = [], responsible_groups_dest = [], guest_groups_dest = [], standard_groups_source = [], privileged_groups_source = [], responsible_groups_source = [], guest_groups_source = [], create = None ): # forget about it, this is a scoria from the POST FORM to variable conversion. del create title = _("New user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("Password must be at least %d characters long!%s") % (configuration.mAutoPasswdSize, rewind))) command = [ "sudo", "add", "user", '--quiet', '--no-colors', '--password', password ] if firstname != '' and lastname != '': command.extend(['--firstname', firstname, '--lastname', lastname]) if gecos != '': command.extend(['--gecos', gecos]) # TODO: set a default profile (see issue #6) if profile != None: command.extend([ "--profile", profile ]) if login != "": command.extend([ "--login", login ]) else: # TODO: Idem, "gecos" should be tested against emptyness command.extend([ '--login', hlstr.validate_name(gecos).replace('_', '.').rstrip('.') ]) retval = w.run(command, uri, err_msg = _('Failed to create account <strong>%s</strong>!') % login) # TODO: Change test since message received: Added user <login> if retval != "": return w.page(title, data + retval) # XXX: this is less than suboptimal to have to do this here... # but without this, adding to supplemental groups doesnt work. users.reload() command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to add user <strong>%s</strong> to requested groups/privileges/responsibilities/invitations!') % login))
| 477,953
|
def create(uri, http_user, loginShell, password, password_confirm, profile = None, login = "", gecos = "", firstname = "", lastname = "", standard_groups_dest = [], privileged_groups_dest = [], responsible_groups_dest = [], guest_groups_dest = [], standard_groups_source = [], privileged_groups_source = [], responsible_groups_source = [], guest_groups_source = [], create = None ): # forget about it, this is a scoria from the POST FORM to variable conversion. del create title = _("New user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("Password must be at least %d characters long!%s") % (configuration.mAutoPasswdSize, rewind))) command = [ "sudo", "add", "user", '--quiet', '--no-colors', '--password', password ] if firstname != '' and lastname != '': command.extend(['--firstname', firstname, '--lastname', lastname]) if gecos != '': command.extend(['--gecos', gecos]) # TODO: set a default profile (see issue #6) if profile != None: command.extend([ "--profile", profile ]) if login != "": command.extend([ "--login", login ]) else: # TODO: Idem, "gecos" should be tested against emptyness command.extend([ '--login', hlstr.validate_name(gecos).replace('_', '.').rstrip('.') ]) retval = w.run(command, uri, err_msg = _('Failed to create account <strong>%s</strong>!') % login) # TODO: Change test since message received: Added user <login> if retval != "": return w.page(title, data + retval) # XXX: this is less than suboptimal to have to do this here... # but without this, adding to supplemental groups doesnt work. users.reload() command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to add user <strong>%s</strong> to requested groups/privileges/responsibilities/invitations!') % login))
|
def create(uri, http_user, loginShell, password, password_confirm, profile = None, login = "", gecos = "", firstname = "", lastname = "", standard_groups_dest = [], privileged_groups_dest = [], responsible_groups_dest = [], guest_groups_dest = [], standard_groups_source = [], privileged_groups_source = [], responsible_groups_source = [], guest_groups_source = [], create = None ): # forget about it, this is a scoria from the POST FORM to variable conversion. del create title = _("New user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("Password must be at least %d characters long!%s") % (configuration.mAutoPasswdSize, rewind))) command = [ "sudo", "add", "user", '--quiet', '--no-colors', '--password', password ] if firstname != '' and lastname != '': command.extend(['--firstname', firstname, '--lastname', lastname]) if gecos != '': command.extend(['--gecos', gecos]) # TODO: set a default profile (see issue #6) if profile != None: command.extend([ "--profile", profile ]) if login != "": command.extend([ "--login", login ]) else: # TODO: Idem, "gecos" should be tested against emptyness command.extend([ '--login', hlstr.validate_name(gecos).replace('_', '.').rstrip('.') ]) retval = w.run(command, uri, err_msg = _('Failed to create account <strong>%s</strong>!') % login) # TODO: Change test since message received: Added user <login> if retval != "": return w.page(title, data + retval) # XXX: this is less than suboptimal to have to do this here... # but without this, adding to supplemental groups doesnt work. users.reload() command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to add user <strong>%s</strong> to requested groups/privileges/responsibilities/invitations!') % login))
| 477,954
|
def create(uri, http_user, loginShell, password, password_confirm, profile = None, login = "", gecos = "", firstname = "", lastname = "", standard_groups_dest = [], privileged_groups_dest = [], responsible_groups_dest = [], guest_groups_dest = [], standard_groups_source = [], privileged_groups_source = [], responsible_groups_source = [], guest_groups_source = [], create = None ): # forget about it, this is a scoria from the POST FORM to variable conversion. del create title = _("New user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("Password must be at least %d characters long!%s") % (configuration.mAutoPasswdSize, rewind))) command = [ "sudo", "add", "user", '--quiet', '--no-colors', '--password', password ] if firstname != '' and lastname != '': command.extend(['--firstname', firstname, '--lastname', lastname]) if gecos != '': command.extend(['--gecos', gecos]) # TODO: set a default profile (see issue #6) if profile != None: command.extend([ "--profile", profile ]) if login != "": command.extend([ "--login", login ]) else: # TODO: Idem, "gecos" should be tested against emptyness command.extend([ '--login', hlstr.validate_name(gecos).replace('_', '.').rstrip('.') ]) retval = w.run(command, uri, err_msg = _('Failed to create account <strong>%s</strong>!') % login) # TODO: Change test since message received: Added user <login> if retval != "": return w.page(title, data + retval) # XXX: this is less than suboptimal to have to do this here... # but without this, adding to supplemental groups doesnt work. users.reload() command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to add user <strong>%s</strong> to requested groups/privileges/responsibilities/invitations!') % login))
|
def create(uri, http_user, loginShell, password, password_confirm, profile = None, login = "", gecos = "", firstname = "", lastname = "", standard_groups_dest = [], privileged_groups_dest = [], responsible_groups_dest = [], guest_groups_dest = [], standard_groups_source = [], privileged_groups_source = [], responsible_groups_source = [], guest_groups_source = [], create = None ): # forget about it, this is a scoria from the POST FORM to variable conversion. del create title = _("New user account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("Password must be at least %d characters long!%s") % (configuration.mAutoPasswdSize, rewind))) command = [ "sudo", "add", "user", '--quiet', '--no-colors', '--password', password ] if firstname != '' and lastname != '': command.extend(['--firstname', firstname, '--lastname', lastname]) if gecos != '': command.extend(['--gecos', gecos]) # TODO: set a default profile (see issue #6) if profile != None: command.extend([ "--profile", profile ]) if login != "": command.extend([ "--login", login ]) else: # TODO: Idem, "gecos" should be tested against emptyness command.extend([ '--login', hlstr.validate_name(gecos).replace('_', '.').rstrip('.') ]) retval = w.run(command, uri, err_msg = _('Failed to create account <strong>%s</strong>!') % login) # TODO: Change test since message received: Added user <login> if retval != "": return w.page(title, data + retval) # XXX: this is less than suboptimal to have to do this here... # but without this, adding to supplemental groups doesnt work. users.reload() command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to add user <strong>%s</strong> to requested groups/privileges/responsibilities/invitations!') % login))
| 477,955
|
def edit(uri, http_user, login): """Edit an user account, based on login.""" groups.reload() users.reload() # TODO: profiles.reload() title = _('Edit account %s') % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if users.is_system_login(login): return w.minipage(title, w.error(_('Account edition impossible.'), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) try: user = users.users[users.login_to_uid(login)] try: profile = profiles.profiles[groups.groups[user['gid']]['name']]['name'] except KeyError: profile = _("Standard account") dbl_lists = {} for filter, titles, id in groups_filters_lists_ids: groups.Select(filter) dest = list(user['groups'].copy()) source = [ groups.groups[gid]['name'] for gid in groups.filtered_groups ] for current in dest[:]: try: source.remove(current) except ValueError: dest.remove(current) dest.sort() source.sort() dbl_lists[filter] = w.doubleListBox(titles, id, source, dest) form_name = "user_edit_form" data += '''<div id="edit_form">
|
def edit(uri, http_user, login): """Edit an user account, based on login.""" groups.reload() users.reload() # TODO: profiles.reload() title = _('Edit account %s') % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if users.is_system_login(login): return w.minipage(title, w.error(_('Account edition impossible.'), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) try: user = users.users[users.login_to_uid(login)] try: profile = profiles.profiles[groups.groups[user['gid']]['name']]['name'] except KeyError: profile = _("Standard account") dbl_lists = {} for filter, titles, id in groups_filters_lists_ids: groups.Select(filter) dest = list(user['groups'].copy()) source = [ groups.groups[gid]['name'] for gid in groups.filtered_groups ] for current in dest[:]: try: source.remove(current) except ValueError: dest.remove(current) dest.sort() source.sort() dbl_lists[filter] = w.doubleListBox(titles, id, source, dest) form_name = "user_edit_form" data += '''<div id="edit_form">
| 477,956
|
def edit(uri, http_user, login): """Edit an user account, based on login.""" groups.reload() users.reload() # TODO: profiles.reload() title = _('Edit account %s') % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if users.is_system_login(login): return w.minipage(title, w.error(_('Account edition impossible.'), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) try: user = users.users[users.login_to_uid(login)] try: profile = profiles.profiles[groups.groups[user['gid']]['name']]['name'] except KeyError: profile = _("Standard account") dbl_lists = {} for filter, titles, id in groups_filters_lists_ids: groups.Select(filter) dest = list(user['groups'].copy()) source = [ groups.groups[gid]['name'] for gid in groups.filtered_groups ] for current in dest[:]: try: source.remove(current) except ValueError: dest.remove(current) dest.sort() source.sort() dbl_lists[filter] = w.doubleListBox(titles, id, source, dest) form_name = "user_edit_form" data += '''<div id="edit_form">
|
def edit(uri, http_user, login): """Edit an user account, based on login.""" groups.reload() users.reload() # TODO: profiles.reload() title = _('Edit account %s') % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if users.is_system_login(login): return w.minipage(title, w.error(_('Account edition impossible.'), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) try: user = users.users[users.login_to_uid(login)] try: profile = profiles.profiles[groups.groups[user['gid']]['name']]['name'] except KeyError: profile = _("Standard account") dbl_lists = {} for filter, titles, id in groups_filters_lists_ids: groups.Select(filter) dest = list(user['groups'].copy()) source = [ groups.groups[gid]['name'] for gid in groups.filtered_groups ] for current in dest[:]: try: source.remove(current) except ValueError: dest.remove(current) dest.sort() source.sort() dbl_lists[filter] = w.doubleListBox(titles, id, source, dest) form_name = "user_edit_form" data += '''<div id="edit_form">
| 477,957
|
def edit(uri, http_user, login): """Edit an user account, based on login.""" groups.reload() users.reload() # TODO: profiles.reload() title = _('Edit account %s') % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if users.is_system_login(login): return w.minipage(title, w.error(_('Account edition impossible.'), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) try: user = users.users[users.login_to_uid(login)] try: profile = profiles.profiles[groups.groups[user['gid']]['name']]['name'] except KeyError: profile = _("Standard account") dbl_lists = {} for filter, titles, id in groups_filters_lists_ids: groups.Select(filter) dest = list(user['groups'].copy()) source = [ groups.groups[gid]['name'] for gid in groups.filtered_groups ] for current in dest[:]: try: source.remove(current) except ValueError: dest.remove(current) dest.sort() source.sort() dbl_lists[filter] = w.doubleListBox(titles, id, source, dest) form_name = "user_edit_form" data += '''<div id="edit_form">
|
def edit(uri, http_user, login): """Edit an user account, based on login.""" groups.reload() users.reload() # TODO: profiles.reload() title = _('Edit account %s') % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) if users.is_system_login(login): return w.minipage(title, w.error(_('Account edition impossible.'), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) try: user = users.users[users.login_to_uid(login)] try: profile = profiles.profiles[groups.groups[user['gid']]['name']]['name'] except KeyError: profile = _("Standard account") dbl_lists = {} for filter, titles, id in groups_filters_lists_ids: groups.Select(filter) dest = list(user['groups'].copy()) source = [ groups.groups[gid]['name'] for gid in groups.filtered_groups ] for current in dest[:]: try: source.remove(current) except ValueError: dest.remove(current) dest.sort() source.sort() dbl_lists[filter] = w.doubleListBox(titles, id, source, dest) form_name = "user_edit_form" data += '''<div id="edit_form">
| 477,958
|
def record(uri, http_user, login, loginShell = configuration.users.default_shell, password = "", password_confirm = "", firstname = "", lastname = "", gecos = "", standard_groups_source = [], standard_groups_dest = [], privileged_groups_source = [], privileged_groups_dest = [], responsible_groups_source = [], responsible_groups_dest = [], guest_groups_source = [], guest_groups_dest = [], record = None): """Record user account changes.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del record title = _("Modification of account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] users.reload() if users.is_system_login(login): return w.page(title, w.error(_("Recording of informations failed"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) if password != "": if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("The password --%s-- must be at least %d characters long!%s") % (password, configuration.mAutoPasswdSize, rewind))) command.extend([ '--password', password ]) command.extend( [ "--gecos", gecos ] ) add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) del_groups = ','.join(__merge_multi_select(standard_groups_source, privileged_groups_source, responsible_groups_source, guest_groups_source)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) if del_groups != "": command.extend(['--del-groups', del_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to modify one or more parameters of account <strong>%s</strong>!') % login))
|
def record(uri, http_user, login, loginShell = configuration.users.default_shell, password = "", password_confirm = "", firstname = "", lastname = "", gecos = "", standard_groups_source = [], standard_groups_dest = [], privileged_groups_source = [], privileged_groups_dest = [], responsible_groups_source = [], responsible_groups_dest = [], guest_groups_source = [], guest_groups_dest = [], record = None): """Record user account changes.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del record title = _("Modification of account %s") % login data = w.page_body_start(uri, http_user, ctxtnav, title, False) command = [ "sudo", "mod", "user", '--quiet', "--no-colors", "--login", login, "--shell", loginShell ] users.reload() if users.is_system_login(login): return w.page(title, w.error(_("Recording of informations failed"), [ _("alter system account.") ], _("insufficient permissions to perform operation."))) if password != "": if password != password_confirm: return w.page(title, data + w.error(_("Passwords do not match!%s") % rewind)) if len(password) < configuration.mAutoPasswdSize: return w.page(title, data + w.error(_("The password --%s-- must be at least %d characters long!%s") % (password, configuration.mAutoPasswdSize, rewind))) command.extend([ '--password', password ]) command.extend( [ "--gecos", gecos ] ) add_groups = ','.join(__merge_multi_select(standard_groups_dest, privileged_groups_dest, responsible_groups_dest, guest_groups_dest)) del_groups = ','.join(__merge_multi_select(standard_groups_source, privileged_groups_source, responsible_groups_source, guest_groups_source)) if add_groups != "": command.extend([ '--add-groups', add_groups ]) if del_groups != "": command.extend(['--del-groups', del_groups ]) data += w.page_body_end() return w.page(title, data + w.run(command, uri, err_msg = _('Failed to modify one or more parameters of account <strong>%s</strong>!') % login))
| 477,959
|
def main(uri, http_user, sort = "login", order = "asc"): start = time.time() groups.reload() users.reload() # TODO: profiles.reload() u = users.users g = groups.groups p = profiles.profiles groups.Select(groups.FILTER_PRIVILEGED) pri_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] groups.Select(groups.FILTER_RESPONSIBLE) rsp_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] groups.Select(groups.FILTER_GUEST) gst_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] groups.Select(groups.FILTER_STANDARD) std_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] accounts = {} ordered = {} totals = {} prof = {} for profile in p: prof[groups.name_to_gid(profile)] = p[profile] totals[p[profile]['name']] = 0 totals[_('Standard account')] = 0 title = _("User accounts") data = w.page_body_start(uri, http_user, ctxtnav, title) if order == "asc": reverseorder = "desc" else: reverseorder = "asc" data += '<table>\n <tr>\n' for (sortcolumn, sortname) in ( ("gecos", _("Full name")), ("login", _("Identifier")), ("profile", _("Profile")), ("locked", _("Locked")) ): if sortcolumn == sort: data += ''' <th><img src="/images/sort_%s.gif" alt="%s order image" />  <a href="/users/list/%s/%s" title="%s">%s</a> </th>\n''' % (order, order, sortcolumn, reverseorder, _("Click to sort in reverse order."), sortname) else: data += ' <th><a href="/users/list/%s/asc" title="%s">%s</a></th>\n' % (sortcolumn, _("Click to sort on this column."), sortname) data += ' </tr>\n' def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>') html_data = ''' <tr class="userdata"> <td class="paddedleft"> <a href="/users/edit/%s" title="%s" class="edit-entry">%s</a> </td> <td class="paddedright"> <a href="/users/edit/%s" title="%s" class="edit-entry">%s</a> </td> <td style="text-align:center;">%s</td> ''' % (login, edit, u[uid]['gecos'], login, edit, login, accounts[uid]['profile_name']) if u[uid]['locked']: html_data += ''' <td class="user_action_center"> <a href="/users/unlock/%s" title="%s"> <img src="/images/16x16/locked.png" alt="%s"/></a> </td> ''' % (login, _("Unlock password (re-grant access to machines)."), _("Remove account.")) else: html_data += ''' <td class="user_action_center"> <a href="/users/lock/%s" title="%s"> <img src="/images/16x16/unlocked.png" alt="%s"/></a> </td> ''' % (login, _("Lock password (revoke access to machines)."), _("Lock account.")) html_data += ''' <td class="user_action"> <a href="/users/skel/%s" title="%s" class="reapply-skel"><span class="delete-entry"> </span></a> </td> <td class="user_action"> <a href="/users/delete/%s" title="%s" class="delete-entry"><span class="delete-entry"> </span></a> </td> </tr> ''' % (login, _("""Reapply origin skel data in the personnal directory of user. This is usefull when user has lost icons, or modified too much his/her desktop (menus, panels and so on). This will get all his/her desktop back."""), login, _("Definitely remove account from the system.")) return html_data users.Select(users.FILTER_STANDARD) for uid in users.filtered_users: user = u[uid] login = user['login'] # we add the login to gecosValue and lockedValue to be sure to obtain # unique values. This prevents problems with empty or non-unique GECOS # and when sorting on locked status (accounts would be overwritten and # lost because sorting must be done on unique values). accounts[uid] = { 'login' : login, 'gecos' : "%s %s" % ( user['gecos'], login ), 'locked' : "%s %s" % ( str(user['locked']), login ) } try: p = prof[user['gid']]['name'] except KeyError: p = _("Standard account") accounts[uid]['profile'] = "%s %s" % ( p, login ) accounts[uid]['profile_name'] = p totals[p] += 1 # index on the column choosen for sorting, and keep trace of the uid # to find account data back after ordering. ordered[hlstr.validate_name(accounts[uid][sort])] = uid memberkeys = ordered.keys() memberkeys.sort() if order == "desc": memberkeys.reverse() data += ''.join(map(html_build_compact, memberkeys)) def print_totals(totals): output = "" for total in totals: if totals[total] != 0: output += ''' <tr class="list_total"> <td colspan="3" class="total_left">%s</td> <td colspan="3" class="total_right">%d</td> </tr> ''' % (_("number of <strong>%s</strong>:") % total, totals[total]) return output data += ''' <tr> <td colspan="6"> </td></tr> %s <tr class="list_total"> <td colspan="3" class="total_left">%s</td> <td colspan="3" class="total_right">%d</td> </tr>
|
def main(uri, http_user, sort = "login", order = "asc"): start = time.time() groups.reload() users.reload() # TODO: profiles.reload() u = users.users g = groups.groups p = profiles.profiles groups.Select(groups.FILTER_PRIVILEGED) pri_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] groups.Select(groups.FILTER_RESPONSIBLE) rsp_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] groups.Select(groups.FILTER_GUEST) gst_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] groups.Select(groups.FILTER_STANDARD) std_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] accounts = {} ordered = {} totals = {} prof = {} for profile in p: prof[groups.name_to_gid(profile)] = p[profile] totals[p[profile]['name']] = 0 totals[_('Standard account')] = 0 title = _("User accounts") data = w.page_body_start(uri, http_user, ctxtnav, title) if order == "asc": reverseorder = "desc" else: reverseorder = "asc" data += '<table>\n <tr>\n' for (sortcolumn, sortname) in ( ("gecos", _("Full name")), ("login", _("Identifier")), ("profile", _("Profile")), ("locked", _("Locked")) ): if sortcolumn == sort: data += ''' <th><img src="/images/sort_%s.gif" alt="%s order image" />  <a href="/users/list/%s/%s" title="%s">%s</a> </th>\n''' % (order, order, sortcolumn, reverseorder, _("Click to sort in reverse order."), sortname) else: data += ' <th><a href="/users/list/%s/asc" title="%s">%s</a></th>\n' % (sortcolumn, _("Click to sort on this column."), sortname) data += ' </tr>\n' def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>') html_data = ''' <tr class="userdata"> <td class="paddedleft"> <a href="/users/edit/%s" title="%s" class="edit-entry">%s</a> </td> <td class="paddedright"> <a href="/users/edit/%s" title="%s" class="edit-entry">%s</a> </td> <td style="text-align:center;">%s</td> ''' % (login, edit, u[uid]['gecos'], login, edit, login, accounts[uid]['profile_name']) if u[uid]['locked']: html_data += ''' <td class="user_action_center"> <a href="/users/unlock/%s" title="%s"> <img src="/images/16x16/locked.png" alt="%s"/></a> </td> ''' % (login, _("Unlock password (re-grant access to machines)."), _("Remove account.")) else: html_data += ''' <td class="user_action_center"> <a href="/users/lock/%s" title="%s"> <img src="/images/16x16/unlocked.png" alt="%s"/></a> </td> ''' % (login, _("Lock password (revoke access to machines)."), _("Lock account.")) html_data += ''' <td class="user_action"> <a href="/users/skel/%s" title="%s" class="reapply-skel"><span class="delete-entry"> </span></a> </td> <td class="user_action"> <a href="/users/delete/%s" title="%s" class="delete-entry"><span class="delete-entry"> </span></a> </td> </tr> ''' % (login, _("""Reapply origin skel data in the personnal directory of user. This is usefull when user has lost icons, or modified too much his/her desktop (menus, panels and so on). This will get all his/her desktop back."""), login, _("Definitely remove account from the system.")) return html_data users.Select(users.FILTER_STANDARD) for uid in users.filtered_users: user = u[uid] login = user['login'] # we add the login to gecosValue and lockedValue to be sure to obtain # unique values. This prevents problems with empty or non-unique GECOS # and when sorting on locked status (accounts would be overwritten and # lost because sorting must be done on unique values). accounts[uid] = { 'login' : login, 'gecos' : "%s %s" % ( user['gecos'], login ), 'locked' : "%s %s" % ( str(user['locked']), login ) } try: p = prof[user['gid']]['name'] except KeyError: p = _("Standard account") accounts[uid]['profile'] = "%s %s" % ( p, login ) accounts[uid]['profile_name'] = p totals[p] += 1 # index on the column choosen for sorting, and keep trace of the uid # to find account data back after ordering. ordered[hlstr.validate_name(accounts[uid][sort])] = uid memberkeys = ordered.keys() memberkeys.sort() if order == "desc": memberkeys.reverse() data += ''.join(map(html_build_compact, memberkeys)) def print_totals(totals): output = "" for total in totals: if totals[total] != 0: output += ''' <tr class="list_total"> <td colspan="3" class="total_left">%s</td> <td colspan="3" class="total_right">%d</td> </tr> ''' % (_("number of <strong>%s</strong>:") % total, totals[total]) return output data += ''' <tr> <td colspan="6"> </td></tr> %s <tr class="list_total"> <td colspan="3" class="total_left">%s</td> <td colspan="3" class="total_right">%d</td> </tr>
| 477,960
|
def main(uri, http_user, sort = "login", order = "asc"): start = time.time() groups.reload() users.reload() # TODO: profiles.reload() u = users.users g = groups.groups p = profiles.profiles groups.Select(groups.FILTER_PRIVILEGED) pri_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] groups.Select(groups.FILTER_RESPONSIBLE) rsp_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] groups.Select(groups.FILTER_GUEST) gst_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] groups.Select(groups.FILTER_STANDARD) std_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] accounts = {} ordered = {} totals = {} prof = {} for profile in p: prof[groups.name_to_gid(profile)] = p[profile] totals[p[profile]['name']] = 0 totals[_('Standard account')] = 0 title = _("User accounts") data = w.page_body_start(uri, http_user, ctxtnav, title) if order == "asc": reverseorder = "desc" else: reverseorder = "asc" data += '<table>\n <tr>\n' for (sortcolumn, sortname) in ( ("gecos", _("Full name")), ("login", _("Identifier")), ("profile", _("Profile")), ("locked", _("Locked")) ): if sortcolumn == sort: data += ''' <th><img src="/images/sort_%s.gif" alt="%s order image" />  <a href="/users/list/%s/%s" title="%s">%s</a> </th>\n''' % (order, order, sortcolumn, reverseorder, _("Click to sort in reverse order."), sortname) else: data += ' <th><a href="/users/list/%s/asc" title="%s">%s</a></th>\n' % (sortcolumn, _("Click to sort on this column."), sortname) data += ' </tr>\n' def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>') html_data = ''' <tr class="userdata"> <td class="paddedleft"> <a href="/users/edit/%s" title="%s" class="edit-entry">%s</a> </td> <td class="paddedright"> <a href="/users/edit/%s" title="%s" class="edit-entry">%s</a> </td> <td style="text-align:center;">%s</td> ''' % (login, edit, u[uid]['gecos'], login, edit, login, accounts[uid]['profile_name']) if u[uid]['locked']: html_data += ''' <td class="user_action_center"> <a href="/users/unlock/%s" title="%s"> <img src="/images/16x16/locked.png" alt="%s"/></a> </td> ''' % (login, _("Unlock password (re-grant access to machines)."), _("Remove account.")) else: html_data += ''' <td class="user_action_center"> <a href="/users/lock/%s" title="%s"> <img src="/images/16x16/unlocked.png" alt="%s"/></a> </td> ''' % (login, _("Lock password (revoke access to machines)."), _("Lock account.")) html_data += ''' <td class="user_action"> <a href="/users/skel/%s" title="%s" class="reapply-skel"><span class="delete-entry"> </span></a> </td> <td class="user_action"> <a href="/users/delete/%s" title="%s" class="delete-entry"><span class="delete-entry"> </span></a> </td> </tr> ''' % (login, _("""Reapply origin skel data in the personnal directory of user. This is usefull when user has lost icons, or modified too much his/her desktop (menus, panels and so on). This will get all his/her desktop back."""), login, _("Definitely remove account from the system.")) return html_data users.Select(users.FILTER_STANDARD) for uid in users.filtered_users: user = u[uid] login = user['login'] # we add the login to gecosValue and lockedValue to be sure to obtain # unique values. This prevents problems with empty or non-unique GECOS # and when sorting on locked status (accounts would be overwritten and # lost because sorting must be done on unique values). accounts[uid] = { 'login' : login, 'gecos' : "%s %s" % ( user['gecos'], login ), 'locked' : "%s %s" % ( str(user['locked']), login ) } try: p = prof[user['gid']]['name'] except KeyError: p = _("Standard account") accounts[uid]['profile'] = "%s %s" % ( p, login ) accounts[uid]['profile_name'] = p totals[p] += 1 # index on the column choosen for sorting, and keep trace of the uid # to find account data back after ordering. ordered[hlstr.validate_name(accounts[uid][sort])] = uid memberkeys = ordered.keys() memberkeys.sort() if order == "desc": memberkeys.reverse() data += ''.join(map(html_build_compact, memberkeys)) def print_totals(totals): output = "" for total in totals: if totals[total] != 0: output += ''' <tr class="list_total"> <td colspan="3" class="total_left">%s</td> <td colspan="3" class="total_right">%d</td> </tr> ''' % (_("number of <strong>%s</strong>:") % total, totals[total]) return output data += ''' <tr> <td colspan="6"> </td></tr> %s <tr class="list_total"> <td colspan="3" class="total_left">%s</td> <td colspan="3" class="total_right">%d</td> </tr>
|
def main(uri, http_user, sort = "login", order = "asc"): start = time.time() groups.reload() users.reload() # TODO: profiles.reload() u = users.users g = groups.groups p = profiles.profiles groups.Select(groups.FILTER_PRIVILEGED) pri_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] groups.Select(groups.FILTER_RESPONSIBLE) rsp_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] groups.Select(groups.FILTER_GUEST) gst_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] groups.Select(groups.FILTER_STANDARD) std_grps = [ g[gid]['name'] for gid in groups.filtered_groups ] accounts = {} ordered = {} totals = {} prof = {} for profile in p: prof[groups.name_to_gid(profile)] = p[profile] totals[p[profile]['name']] = 0 totals[_('Standard account')] = 0 title = _("User accounts") data = w.page_body_start(uri, http_user, ctxtnav, title) if order == "asc": reverseorder = "desc" else: reverseorder = "asc" data += '<table>\n <tr>\n' for (sortcolumn, sortname) in ( ("gecos", _("Full name")), ("login", _("Identifier")), ("profile", _("Profile")), ("locked", _("Locked")) ): if sortcolumn == sort: data += ''' <th><img src="/images/sort_%s.gif" alt="%s order image" />  <a href="/users/list/%s/%s" title="%s">%s</a> </th>\n''' % (order, order, sortcolumn, reverseorder, _("Click to sort in reverse order."), sortname) else: data += ' <th><a href="/users/list/%s/asc" title="%s">%s</a></th>\n' % (sortcolumn, _("Click to sort on this column."), sortname) data += ' </tr>\n' def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>') html_data = ''' <tr class="userdata"> <td class="paddedleft"> <a href="/users/edit/%s" title="%s" class="edit-entry">%s</a> </td> <td class="paddedright"> <a href="/users/edit/%s" title="%s" class="edit-entry">%s</a> </td> <td style="text-align:center;">%s</td> ''' % (login, edit, u[uid]['gecos'], login, edit, login, accounts[uid]['profile_name']) if u[uid]['locked']: html_data += ''' <td class="user_action_center"> <a href="/users/unlock/%s" title="%s"> <img src="/images/16x16/locked.png" alt="%s"/></a> </td> ''' % (login, _("Unlock password (re-grant access to machines)."), _("Remove account.")) else: html_data += ''' <td class="user_action_center"> <a href="/users/lock/%s" title="%s"> <img src="/images/16x16/unlocked.png" alt="%s"/></a> </td> ''' % (login, _("Lock password (revoke access to machines)."), _("Lock account.")) html_data += ''' <td class="user_action"> <a href="/users/skel/%s" title="%s" class="reapply-skel"><span class="delete-entry"> </span></a> </td> <td class="user_action"> <a href="/users/delete/%s" title="%s" class="delete-entry"><span class="delete-entry"> </span></a> </td> </tr> ''' % (login, _("""Reapply origin skel data in the personnal directory of user. This is usefull when user has lost icons, or modified too much his/her desktop (menus, panels and so on). This will get all his/her desktop back."""), login, _("Definitely remove account from the system.")) return html_data users.Select(users.FILTER_STANDARD) for uid in users.filtered_users: user = u[uid] login = user['login'] # we add the login to gecosValue and lockedValue to be sure to obtain # unique values. This prevents problems with empty or non-unique GECOS # and when sorting on locked status (accounts would be overwritten and # lost because sorting must be done on unique values). accounts[uid] = { 'login' : login, 'gecos' : "%s %s" % ( user['gecos'], login ), 'locked' : "%s %s" % ( str(user['locked']), login ) } try: p = prof[user['gid']]['name'] except KeyError: p = _("Standard account") accounts[uid]['profile'] = "%s %s" % ( p, login ) accounts[uid]['profile_name'] = p totals[p] += 1 # index on the column choosen for sorting, and keep trace of the uid # to find account data back after ordering. ordered[hlstr.validate_name(accounts[uid][sort])] = uid memberkeys = ordered.keys() memberkeys.sort() if order == "desc": memberkeys.reverse() data += ''.join(map(html_build_compact, memberkeys)) def print_totals(totals): output = "" for total in totals: if totals[total] != 0: output += ''' <tr class="list_total"> <td colspan="3" class="total_left">%s</td> <td colspan="3" class="total_right">%d</td> </tr> ''' % (_("number of <strong>%s</strong>:") % total, totals[total]) return output data += ''' <tr> <td colspan="6"> </td></tr> %s <tr class="list_total"> <td colspan="3" class="total_left">%s</td> <td colspan="3" class="total_right">%d</td> </tr>
| 477,961
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>')
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>')
| 477,962
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>')
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>')
| 477,963
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>')
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>')
| 477,964
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>')
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>')
| 477,965
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>')
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>')
| 477,966
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>')
|
def html_build_compact(index, accounts = accounts): uid = ordered[index] login = u[uid]['login'] edit = (_("""<em>Click to edit current user account parameters:</em><br /> UID: <strong>%d</strong><br /> GID: %d (primary group <strong>%s</strong>)<br /><br /> Groups: <strong>%s</strong><br /><br /> Privileges: <strong>%s</strong><br /><br /> Responsabilities: <strong>%s</strong><br /><br /> Invitations: <strong>%s</strong><br /><br /> """) % ( uid, u[uid]['gid'], g[u[uid]['gid']]['name'], ", ".join(filter(lambda x: x in std_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in pri_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in rsp_grps, u[uid]['groups'])), ", ".join(filter(lambda x: x in gst_grps, u[uid]['groups'])))).replace('<','<').replace('>','>')
| 477,967
|
def print_totals(totals): output = "" for total in totals: if totals[total] != 0: output += '''
|
def print_totals(totals): output = "" for total in totals: if totals[total] != 0: output += '''
| 477,968
|
def RunAndCheck(self, cmd, batch = False, inverse_test=False): ref_output, ref_code = self.PrepareReferenceOutput(cmd)
|
def RunAndCheck(self, cmd, batch = False, inverse_test=False): ref_output, ref_code = self.PrepareReferenceOutput(cmd)
| 477,969
|
def ExportCLI(self): """ Export the user profiles list to human readable form. """ data = ""
|
def ExportCLI(self): """ Export the user profiles list to human readable form. """ data = ""
| 477,970
|
def is_restricted_system_gid(self, gid): """ Return true if gid is system, but outside the range of Licorn® controlled GIDs.""" return gid < LMC.configuration.groups.system_gid_min \ and gid > LMC.configuration.groups.gid_max
|
def is_restricted_system_gid(self, gid): """ Return true if gid is system, but outside the range of Licorn® controlled GIDs.""" return gid < LMC.configuration.groups.system_gid_min \ and gid > LMC.configuration.groups.gid_max
| 477,971
|
def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list
|
def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list
| 477,972
|
def cmdfmt(cmd): '''convert a sequence to a colorized string.''' return styles.stylize(styles.ST_NAME, ' '.join(cmd))
|
def cmdfmt(cmd): '''convert a sequence to a colorized string.''' return styles.stylize(styles.ST_NAME, ' '.join(cmd))
| 477,973
|
def test_message(msg): """ display a message to stderr. """ sys.stderr.write("%s>>> %s%s\n" % (styles.colors[styles.ST_LOG], msg, styles.colors[styles.ST_NO]) )
|
def test_message(msg): """ display a message to stderr. """ sys.stderr.write("%s>>> %s%s\n" % (styles.colors[styles.ST_LOG], msg, styles.colors[styles.ST_NO]) )
| 477,974
|
def log_and_exec (command, inverse_test=False, result_code=0, comment="", verb=verbose): """Display a command, execute it, and exit if soemthing went wrong.""" #if not command.startswith('colordiff'): # command += ' %s' % ' '.join(args) sys.stderr.write("%s>>> running %s%s%s\n" % (styles.colors[styles.ST_LOG], styles.colors[styles.ST_PATH], command, styles.colors[styles.ST_NO])) output, retcode = execute(command) must_exit = False # # TODO: implement a precise test on a precise exit value. # for example, when you try to add a group with an invalid name, # licorn-add should exit (e.g.) 34. We must test on this precise # value and not on != 0, because if something wrong but *other* than # errno 34 happened, we won't know it if we don't check carefully the # program output. # if inverse_test: if retcode != result_code: must_exit = True else: if retcode != 0: must_exit = True if must_exit: if inverse_test: test = (" %s→ it should have failed with reason: %s%s%s\n" % (styles.colors[styles.ST_PATH], styles.colors[styles.ST_BAD], comment, styles.colors[styles.ST_NO])) else: test = "" sys.stderr.write(" %s→ return code of command: %s%d%s (expected: %d)%s\n%s → log follows:\n" % ( styles.colors[styles.ST_LOG], styles.colors[styles.ST_BAD], retcode, styles.colors[styles.ST_LOG], result_code, styles.colors[styles.ST_NO], test) ) sys.stderr.write(output) sys.stderr.write( "The last command failed to execute, or return something wrong !\n") raise SystemExit(retcode) if verb: sys.stderr.write(output)
|
def log_and_exec (command, inverse_test=False, result_code=0, comment="", verb=verbose): """Display a command, execute it, and exit if soemthing went wrong.""" #if not command.startswith('colordiff'): # command += ' %s' % ' '.join(args) sys.stderr.write("%s>>> running %s%s%s\n" % (colors[ST_LOG], colors[ST_PATH], command, colors[ST_NO])) output, retcode = execute(command) must_exit = False # # TODO: implement a precise test on a precise exit value. # for example, when you try to add a group with an invalid name, # licorn-add should exit (e.g.) 34. We must test on this precise # value and not on != 0, because if something wrong but *other* than # errno 34 happened, we won't know it if we don't check carefully the # program output. # if inverse_test: if retcode != result_code: must_exit = True else: if retcode != 0: must_exit = True if must_exit: if inverse_test: test = (" %s→ it should have failed with reason: %s%s%s\n" % (styles.colors[styles.ST_PATH], styles.colors[styles.ST_BAD], comment, styles.colors[styles.ST_NO])) else: test = "" sys.stderr.write(" %s→ return code of command: %s%d%s (expected: %d)%s\n%s → log follows:\n" % ( styles.colors[styles.ST_LOG], styles.colors[styles.ST_BAD], retcode, styles.colors[styles.ST_LOG], result_code, styles.colors[styles.ST_NO], test) ) sys.stderr.write(output) sys.stderr.write( "The last command failed to execute, or return something wrong !\n") raise SystemExit(retcode) if verb: sys.stderr.write(output)
| 477,975
|
def log_and_exec (command, inverse_test=False, result_code=0, comment="", verb=verbose): """Display a command, execute it, and exit if soemthing went wrong.""" #if not command.startswith('colordiff'): # command += ' %s' % ' '.join(args) sys.stderr.write("%s>>> running %s%s%s\n" % (styles.colors[styles.ST_LOG], styles.colors[styles.ST_PATH], command, styles.colors[styles.ST_NO])) output, retcode = execute(command) must_exit = False # # TODO: implement a precise test on a precise exit value. # for example, when you try to add a group with an invalid name, # licorn-add should exit (e.g.) 34. We must test on this precise # value and not on != 0, because if something wrong but *other* than # errno 34 happened, we won't know it if we don't check carefully the # program output. # if inverse_test: if retcode != result_code: must_exit = True else: if retcode != 0: must_exit = True if must_exit: if inverse_test: test = (" %s→ it should have failed with reason: %s%s%s\n" % (styles.colors[styles.ST_PATH], styles.colors[styles.ST_BAD], comment, styles.colors[styles.ST_NO])) else: test = "" sys.stderr.write(" %s→ return code of command: %s%d%s (expected: %d)%s\n%s → log follows:\n" % ( styles.colors[styles.ST_LOG], styles.colors[styles.ST_BAD], retcode, styles.colors[styles.ST_LOG], result_code, styles.colors[styles.ST_NO], test) ) sys.stderr.write(output) sys.stderr.write( "The last command failed to execute, or return something wrong !\n") raise SystemExit(retcode) if verb: sys.stderr.write(output)
|
def log_and_exec (command, inverse_test=False, result_code=0, comment="", verb=verbose): """Display a command, execute it, and exit if soemthing went wrong.""" #if not command.startswith('colordiff'): # command += ' %s' % ' '.join(args) sys.stderr.write("%s>>> running %s%s%s\n" % (styles.colors[styles.ST_LOG], styles.colors[styles.ST_PATH], command, styles.colors[styles.ST_NO])) output, retcode = execute(command) must_exit = False # # TODO: implement a precise test on a precise exit value. # for example, when you try to add a group with an invalid name, # licorn-add should exit (e.g.) 34. We must test on this precise # value and not on != 0, because if something wrong but *other* than # errno 34 happened, we won't know it if we don't check carefully the # program output. # if inverse_test: if retcode != result_code: must_exit = True else: if retcode != 0: must_exit = True if must_exit: if inverse_test: test = (" %s→ it should have failed with reason: %s%s%s\n" % (colors[ST_PATH], colors[ST_BAD], comment, colors[ST_NO])) else: test = "" sys.stderr.write(" %s→ return code of command: %s%d%s (expected: %d)%s\n%s → log follows:\n" % ( styles.colors[styles.ST_LOG], styles.colors[styles.ST_BAD], retcode, styles.colors[styles.ST_LOG], result_code, styles.colors[styles.ST_NO], test) ) sys.stderr.write(output) sys.stderr.write( "The last command failed to execute, or return something wrong !\n") raise SystemExit(retcode) if verb: sys.stderr.write(output)
| 477,976
|
def log_and_exec (command, inverse_test=False, result_code=0, comment="", verb=verbose): """Display a command, execute it, and exit if soemthing went wrong.""" #if not command.startswith('colordiff'): # command += ' %s' % ' '.join(args) sys.stderr.write("%s>>> running %s%s%s\n" % (styles.colors[styles.ST_LOG], styles.colors[styles.ST_PATH], command, styles.colors[styles.ST_NO])) output, retcode = execute(command) must_exit = False # # TODO: implement a precise test on a precise exit value. # for example, when you try to add a group with an invalid name, # licorn-add should exit (e.g.) 34. We must test on this precise # value and not on != 0, because if something wrong but *other* than # errno 34 happened, we won't know it if we don't check carefully the # program output. # if inverse_test: if retcode != result_code: must_exit = True else: if retcode != 0: must_exit = True if must_exit: if inverse_test: test = (" %s→ it should have failed with reason: %s%s%s\n" % (styles.colors[styles.ST_PATH], styles.colors[styles.ST_BAD], comment, styles.colors[styles.ST_NO])) else: test = "" sys.stderr.write(" %s→ return code of command: %s%d%s (expected: %d)%s\n%s → log follows:\n" % ( styles.colors[styles.ST_LOG], styles.colors[styles.ST_BAD], retcode, styles.colors[styles.ST_LOG], result_code, styles.colors[styles.ST_NO], test) ) sys.stderr.write(output) sys.stderr.write( "The last command failed to execute, or return something wrong !\n") raise SystemExit(retcode) if verb: sys.stderr.write(output)
|
def log_and_exec (command, inverse_test=False, result_code=0, comment="", verb=verbose): """Display a command, execute it, and exit if soemthing went wrong.""" #if not command.startswith('colordiff'): # command += ' %s' % ' '.join(args) sys.stderr.write("%s>>> running %s%s%s\n" % (styles.colors[styles.ST_LOG], styles.colors[styles.ST_PATH], command, styles.colors[styles.ST_NO])) output, retcode = execute(command) must_exit = False # # TODO: implement a precise test on a precise exit value. # for example, when you try to add a group with an invalid name, # licorn-add should exit (e.g.) 34. We must test on this precise # value and not on != 0, because if something wrong but *other* than # errno 34 happened, we won't know it if we don't check carefully the # program output. # if inverse_test: if retcode != result_code: must_exit = True else: if retcode != 0: must_exit = True if must_exit: if inverse_test: test = (" %s→ it should have failed with reason: %s%s%s\n" % (styles.colors[styles.ST_PATH], styles.colors[styles.ST_BAD], comment, styles.colors[styles.ST_NO])) else: test = "" sys.stderr.write(" %s→ return code of command: %s%d%s (expected: %d)%s\n%s → log follows:\n" % ( colors[ST_LOG], colors[ST_BAD], retcode, colors[ST_LOG], result_code, colors[ST_NO], test) ) sys.stderr.write(output) sys.stderr.write( "The last command failed to execute, or return something wrong !\n") raise SystemExit(retcode) if verb: sys.stderr.write(output)
| 477,977
|
def strip_dates(str): """ strip dates from warnings and traces, else outputs and references always compare false .""" return re.sub(r'\s\[\d\d\d\d/\d\d/\d\d\s\d\d:\d\d:\d\d\.\d\d\d\d\]\s', r' [D/T] ', str)
|
def strip_dates(str): """ strip dates from warnings and traces, else outputs and references always compare false .""" return re.sub(r'(\.\d\d\d\d\d\d\d\d-\d\d\d\d\d\d|\s\[\d\d\d\d/\d\d/\d\d\s\d\d:\d\d:\d\d\.\d\d\d\d\]\s)', r' [D/T] ', str)
| 477,978
|
def strip_dates(str): """ strip dates from warnings and traces, else outputs and references always compare false .""" return re.sub(r'\s\[\d\d\d\d/\d\d/\d\d\s\d\d:\d\d:\d\d\.\d\d\d\d\]\s', r' [D/T] ', str)
|
def strip_dates(str): """ strip dates from warnings and traces, else outputs and references always compare false .""" return re.sub(r'\s\[\d\d\d\d/\d\d/\d\d\s\d\d:\d\d:\d\d\.\d\d\d\d\]\s', r' [D/T] ', str)
| 477,979
|
def __init__(self, cmd, pre_cmds=[], chk_cmds=[], manual_output=False, reference_cmd=[], context='std'):
|
def __init__(self, cmd, pre_cmds=[], chk_cmds=[], manual_output=False, reference_cmd=[], context='std'):
| 477,980
|
def SaveOutput(self, output, code):
|
def SaveOutput(self, output, code):
| 477,981
|
def SaveOutput(self, output, code):
|
def SaveOutput(self, output, code):
| 477,982
|
def PrepareReferenceOutput(self, cmd):
|
def PrepareReferenceOutput(self, cmd):
| 477,983
|
def PrepareReferenceOutput(self, cmd):
|
def PrepareReferenceOutput(self, cmd):
| 477,984
|
def PrepareReferenceOutput(self, cmd):
|
def PrepareReferenceOutput(self, cmd):
| 477,985
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" test_message('testing integrated help.') for program in (GETENT, ADD, MODIFY, DELETE, CHECK): FunctionnalTest(program).Run(options = [['-h'], ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MODIFY: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DELETE: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GETENT: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHECK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GETENT and mode == 'configuration': FunctionnalTest(program + [mode]).Run() else: FunctionnalTest(program + [mode]).Run(options = [['-h'], ['--help']]) test_message('integrated help testing finished.')
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" commands = [] for program in (GET, ADD, MOD, DEL, CHK): commands.extend([ program + ['-h'], program + ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MODIFY: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DELETE: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GETENT: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHECK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GETENT and mode == 'configuration': FunctionnalTest(program + [mode]).Run() else: FunctionnalTest(program + [mode]).Run(options = [['-h'], ['--help']]) test_message('integrated help testing finished.')
| 477,986
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" test_message('testing integrated help.') for program in (GETENT, ADD, MODIFY, DELETE, CHECK): FunctionnalTest(program).Run(options = [['-h'], ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MODIFY: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DELETE: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GETENT: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHECK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GETENT and mode == 'configuration': FunctionnalTest(program + [mode]).Run() else: FunctionnalTest(program + [mode]).Run(options = [['-h'], ['--help']]) test_message('integrated help testing finished.')
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" test_message('testing integrated help.') for program in (GETENT, ADD, MODIFY, DELETE, CHECK): FunctionnalTest(program).Run(options = [['-h'], ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MOD: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DELETE: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GETENT: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHECK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GETENT and mode == 'configuration': FunctionnalTest(program + [mode]).Run() else: FunctionnalTest(program + [mode]).Run(options = [['-h'], ['--help']]) test_message('integrated help testing finished.')
| 477,987
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" test_message('testing integrated help.') for program in (GETENT, ADD, MODIFY, DELETE, CHECK): FunctionnalTest(program).Run(options = [['-h'], ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MODIFY: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DELETE: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GETENT: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHECK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GETENT and mode == 'configuration': FunctionnalTest(program + [mode]).Run() else: FunctionnalTest(program + [mode]).Run(options = [['-h'], ['--help']]) test_message('integrated help testing finished.')
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" test_message('testing integrated help.') for program in (GETENT, ADD, MODIFY, DELETE, CHECK): FunctionnalTest(program).Run(options = [['-h'], ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MODIFY: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DEL: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GETENT: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHECK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GETENT and mode == 'configuration': FunctionnalTest(program + [mode]).Run() else: FunctionnalTest(program + [mode]).Run(options = [['-h'], ['--help']]) test_message('integrated help testing finished.')
| 477,988
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" test_message('testing integrated help.') for program in (GETENT, ADD, MODIFY, DELETE, CHECK): FunctionnalTest(program).Run(options = [['-h'], ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MODIFY: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DELETE: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GETENT: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHECK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GETENT and mode == 'configuration': FunctionnalTest(program + [mode]).Run() else: FunctionnalTest(program + [mode]).Run(options = [['-h'], ['--help']]) test_message('integrated help testing finished.')
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" test_message('testing integrated help.') for program in (GETENT, ADD, MODIFY, DELETE, CHECK): FunctionnalTest(program).Run(options = [['-h'], ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MODIFY: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DELETE: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GET: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHECK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GETENT and mode == 'configuration': FunctionnalTest(program + [mode]).Run() else: FunctionnalTest(program + [mode]).Run(options = [['-h'], ['--help']]) test_message('integrated help testing finished.')
| 477,989
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" test_message('testing integrated help.') for program in (GETENT, ADD, MODIFY, DELETE, CHECK): FunctionnalTest(program).Run(options = [['-h'], ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MODIFY: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DELETE: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GETENT: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHECK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GETENT and mode == 'configuration': FunctionnalTest(program + [mode]).Run() else: FunctionnalTest(program + [mode]).Run(options = [['-h'], ['--help']]) test_message('integrated help testing finished.')
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" test_message('testing integrated help.') for program in (GETENT, ADD, MODIFY, DELETE, CHECK): FunctionnalTest(program).Run(options = [['-h'], ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MODIFY: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DELETE: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GETENT: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GETENT and mode == 'configuration': FunctionnalTest(program + [mode]).Run() else: FunctionnalTest(program + [mode]).Run(options = [['-h'], ['--help']]) test_message('integrated help testing finished.')
| 477,990
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" test_message('testing integrated help.') for program in (GETENT, ADD, MODIFY, DELETE, CHECK): FunctionnalTest(program).Run(options = [['-h'], ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MODIFY: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DELETE: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GETENT: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHECK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GETENT and mode == 'configuration': FunctionnalTest(program + [mode]).Run() else: FunctionnalTest(program + [mode]).Run(options = [['-h'], ['--help']]) test_message('integrated help testing finished.')
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" test_message('testing integrated help.') for program in (GETENT, ADD, MODIFY, DELETE, CHECK): FunctionnalTest(program).Run(options = [['-h'], ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MODIFY: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DELETE: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GETENT: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHECK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GET and mode == 'configuration': commands.append(program + [ mode ]) else: FunctionnalTest(program + [mode]).Run(options = [['-h'], ['--help']]) test_message('integrated help testing finished.')
| 477,991
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" test_message('testing integrated help.') for program in (GETENT, ADD, MODIFY, DELETE, CHECK): FunctionnalTest(program).Run(options = [['-h'], ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MODIFY: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DELETE: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GETENT: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHECK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GETENT and mode == 'configuration': FunctionnalTest(program + [mode]).Run() else: FunctionnalTest(program + [mode]).Run(options = [['-h'], ['--help']]) test_message('integrated help testing finished.')
|
def test_integrated_help (): """Test extensively argmarser contents and intergated help.""" test_message('testing integrated help.') for program in (GETENT, ADD, MODIFY, DELETE, CHECK): FunctionnalTest(program).Run(options = [['-h'], ['--help']]) if program == ADD: modes = [ 'user', 'users', 'group', 'profile' ] elif program == MODIFY: modes = [ 'configuration', 'user', 'group', 'profile' ] elif program == DELETE: modes = [ 'user', 'group', 'groups', 'profile' ] elif program == GETENT: modes = ['user', 'users', 'passwd', 'group', 'groups', 'profiles', 'configuration' ] elif program == CHECK: modes = ['user', 'users', 'group', 'groups', 'profile', 'profiles', 'configuration' ] for mode in modes: if program == GETENT and mode == 'configuration': FunctionnalTest(program + [mode]).Run() else: commands.extend([ program + [ mode, '-h'], program + [ mode, '--help'] ]) ScenarioTest(commands, descr="integrated help").Run()
| 477,992
|
def test_get(context): """Test GET a lot.""" test_message('''starting get tests.''') for category in [ 'config_dir', 'main_config_file', 'extendedgroup_data_file' ]: for mode in [ '', '-s', '-b', '--bourne-shell', '-c', '--c-shell', '-p', '--php-code' ]: FunctionnalTest(GETENT + [ 'configuration', category, mode ], context=context).Run() for category in [ 'skels', 'shells', 'backends' ]: FunctionnalTest(GETENT + [ 'config', category ], context=context).Run() commands = ( # users GETENT + [ "users" ], GETENT + [ "users", "--xml" ], GETENT + [ "users", "--long" ], GETENT + [ "users", "--long", "--xml" ], GETENT + [ "users", "--all" ], GETENT + [ "users", "--xml", "--all" ], GETENT + [ "users", "--all", "--long" ], GETENT + [ "users", "--xml", "--all", "--long" ], # groups GETENT + [ "groups" ], GETENT + [ "groups", "--xml" ], GETENT + [ "groups", "--long" ], GETENT + [ "groups", "--long", "--xml" ], GETENT + [ "groups", "--xml", "--all" ], GETENT + [ "groups", "--xml", "--all", "--long" ], GETENT + [ "groups", "--xml", "--guests" ], GETENT + [ "groups", "--xml", "--guests", "--long " ], GETENT + [ "groups", "--xml", "--responsibles" ], GETENT + [ "groups", "--xml", "--responsibles", "--long" ], GETENT + [ "groups", "--xml", "--privileged" ], GETENT + [ "groups", "--xml", "--privileged", "--long" ], # Profiles GETENT + [ "profiles" ], GETENT + [ "profiles", "--xml" ], ) for command in commands: FunctionnalTest(command, context=context) test_message('''`get` tests finished.''')
|
def test_get(context): """Test GET a lot.""" commands = [] for category in [ 'config_dir', 'main_config_file', 'extendedgroup_data_file' ]: for mode in [ '', '-s', '-b', '--bourne-shell', '-c', '--c-shell', '-p', '--php-code' ]: FunctionnalTest(GETENT + [ 'configuration', category, mode ], context=context).Run() for category in [ 'skels', 'shells', 'backends' ]: FunctionnalTest(GETENT + [ 'config', category ], context=context).Run() commands = ( # users GETENT + [ "users" ], GETENT + [ "users", "--xml" ], GETENT + [ "users", "--long" ], GETENT + [ "users", "--long", "--xml" ], GETENT + [ "users", "--all" ], GETENT + [ "users", "--xml", "--all" ], GETENT + [ "users", "--all", "--long" ], GETENT + [ "users", "--xml", "--all", "--long" ], # groups GETENT + [ "groups" ], GETENT + [ "groups", "--xml" ], GETENT + [ "groups", "--long" ], GETENT + [ "groups", "--long", "--xml" ], GETENT + [ "groups", "--xml", "--all" ], GETENT + [ "groups", "--xml", "--all", "--long" ], GETENT + [ "groups", "--xml", "--guests" ], GETENT + [ "groups", "--xml", "--guests", "--long " ], GETENT + [ "groups", "--xml", "--responsibles" ], GETENT + [ "groups", "--xml", "--responsibles", "--long" ], GETENT + [ "groups", "--xml", "--privileged" ], GETENT + [ "groups", "--xml", "--privileged", "--long" ], # Profiles GETENT + [ "profiles" ], GETENT + [ "profiles", "--xml" ], ) for command in commands: FunctionnalTest(command, context=context) test_message('''`get` tests finished.''')
| 477,993
|
def test_get(context): """Test GET a lot.""" test_message('''starting get tests.''') for category in [ 'config_dir', 'main_config_file', 'extendedgroup_data_file' ]: for mode in [ '', '-s', '-b', '--bourne-shell', '-c', '--c-shell', '-p', '--php-code' ]: FunctionnalTest(GETENT + [ 'configuration', category, mode ], context=context).Run() for category in [ 'skels', 'shells', 'backends' ]: FunctionnalTest(GETENT + [ 'config', category ], context=context).Run() commands = ( # users GETENT + [ "users" ], GETENT + [ "users", "--xml" ], GETENT + [ "users", "--long" ], GETENT + [ "users", "--long", "--xml" ], GETENT + [ "users", "--all" ], GETENT + [ "users", "--xml", "--all" ], GETENT + [ "users", "--all", "--long" ], GETENT + [ "users", "--xml", "--all", "--long" ], # groups GETENT + [ "groups" ], GETENT + [ "groups", "--xml" ], GETENT + [ "groups", "--long" ], GETENT + [ "groups", "--long", "--xml" ], GETENT + [ "groups", "--xml", "--all" ], GETENT + [ "groups", "--xml", "--all", "--long" ], GETENT + [ "groups", "--xml", "--guests" ], GETENT + [ "groups", "--xml", "--guests", "--long " ], GETENT + [ "groups", "--xml", "--responsibles" ], GETENT + [ "groups", "--xml", "--responsibles", "--long" ], GETENT + [ "groups", "--xml", "--privileged" ], GETENT + [ "groups", "--xml", "--privileged", "--long" ], # Profiles GETENT + [ "profiles" ], GETENT + [ "profiles", "--xml" ], ) for command in commands: FunctionnalTest(command, context=context) test_message('''`get` tests finished.''')
|
def test_get(context): """Test GET a lot.""" test_message('''starting get tests.''') for category in [ 'config_dir', 'main_config_file', 'extendedgroup_data_file' ]: for mode in [ '', '-s', '-b', '--bourne-shell', '-c', '--c-shell', '-p', '--php-code' ]: commands.append(GET + [ 'configuration', category, mode ]) for category in [ 'skels', 'shells', 'backends' ]: FunctionnalTest(GETENT + [ 'config', category ], context=context).Run() commands = ( # users GETENT + [ "users" ], GETENT + [ "users", "--xml" ], GETENT + [ "users", "--long" ], GETENT + [ "users", "--long", "--xml" ], GETENT + [ "users", "--all" ], GETENT + [ "users", "--xml", "--all" ], GETENT + [ "users", "--all", "--long" ], GETENT + [ "users", "--xml", "--all", "--long" ], # groups GETENT + [ "groups" ], GETENT + [ "groups", "--xml" ], GETENT + [ "groups", "--long" ], GETENT + [ "groups", "--long", "--xml" ], GETENT + [ "groups", "--xml", "--all" ], GETENT + [ "groups", "--xml", "--all", "--long" ], GETENT + [ "groups", "--xml", "--guests" ], GETENT + [ "groups", "--xml", "--guests", "--long " ], GETENT + [ "groups", "--xml", "--responsibles" ], GETENT + [ "groups", "--xml", "--responsibles", "--long" ], GETENT + [ "groups", "--xml", "--privileged" ], GETENT + [ "groups", "--xml", "--privileged", "--long" ], # Profiles GETENT + [ "profiles" ], GETENT + [ "profiles", "--xml" ], ) for command in commands: FunctionnalTest(command, context=context) test_message('''`get` tests finished.''')
| 477,994
|
def test_get(context): """Test GET a lot.""" test_message('''starting get tests.''') for category in [ 'config_dir', 'main_config_file', 'extendedgroup_data_file' ]: for mode in [ '', '-s', '-b', '--bourne-shell', '-c', '--c-shell', '-p', '--php-code' ]: FunctionnalTest(GETENT + [ 'configuration', category, mode ], context=context).Run() for category in [ 'skels', 'shells', 'backends' ]: FunctionnalTest(GETENT + [ 'config', category ], context=context).Run() commands = ( # users GETENT + [ "users" ], GETENT + [ "users", "--xml" ], GETENT + [ "users", "--long" ], GETENT + [ "users", "--long", "--xml" ], GETENT + [ "users", "--all" ], GETENT + [ "users", "--xml", "--all" ], GETENT + [ "users", "--all", "--long" ], GETENT + [ "users", "--xml", "--all", "--long" ], # groups GETENT + [ "groups" ], GETENT + [ "groups", "--xml" ], GETENT + [ "groups", "--long" ], GETENT + [ "groups", "--long", "--xml" ], GETENT + [ "groups", "--xml", "--all" ], GETENT + [ "groups", "--xml", "--all", "--long" ], GETENT + [ "groups", "--xml", "--guests" ], GETENT + [ "groups", "--xml", "--guests", "--long " ], GETENT + [ "groups", "--xml", "--responsibles" ], GETENT + [ "groups", "--xml", "--responsibles", "--long" ], GETENT + [ "groups", "--xml", "--privileged" ], GETENT + [ "groups", "--xml", "--privileged", "--long" ], # Profiles GETENT + [ "profiles" ], GETENT + [ "profiles", "--xml" ], ) for command in commands: FunctionnalTest(command, context=context) test_message('''`get` tests finished.''')
|
def test_get(context): """Test GET a lot.""" test_message('''starting get tests.''') for category in [ 'config_dir', 'main_config_file', 'extendedgroup_data_file' ]: for mode in [ '', '-s', '-b', '--bourne-shell', '-c', '--c-shell', '-p', '--php-code' ]: FunctionnalTest(GETENT + [ 'configuration', category, mode ], context=context).Run() for category in [ 'skels', 'shells', 'backends' ]: commands.append(GET + [ 'config', category ]) commands += [ # users GETENT + [ "users" ], GETENT + [ "users", "--xml" ], GETENT + [ "users", "--long" ], GETENT + [ "users", "--long", "--xml" ], GETENT + [ "users", "--all" ], GETENT + [ "users", "--xml", "--all" ], GETENT + [ "users", "--all", "--long" ], GETENT + [ "users", "--xml", "--all", "--long" ], # groups GETENT + [ "groups" ], GETENT + [ "groups", "--xml" ], GETENT + [ "groups", "--long" ], GETENT + [ "groups", "--long", "--xml" ], GETENT + [ "groups", "--xml", "--all" ], GETENT + [ "groups", "--xml", "--all", "--long" ], GETENT + [ "groups", "--xml", "--guests" ], GETENT + [ "groups", "--xml", "--guests", "--long " ], GETENT + [ "groups", "--xml", "--responsibles" ], GETENT + [ "groups", "--xml", "--responsibles", "--long" ], GETENT + [ "groups", "--xml", "--privileged" ], GETENT + [ "groups", "--xml", "--privileged", "--long" ], # Profiles GETENT + [ "profiles" ], GETENT + [ "profiles", "--xml" ], ) for command in commands: FunctionnalTest(command, context=context) test_message('''`get` tests finished.''')
| 477,995
|
def test_get(context): """Test GET a lot.""" test_message('''starting get tests.''') for category in [ 'config_dir', 'main_config_file', 'extendedgroup_data_file' ]: for mode in [ '', '-s', '-b', '--bourne-shell', '-c', '--c-shell', '-p', '--php-code' ]: FunctionnalTest(GETENT + [ 'configuration', category, mode ], context=context).Run() for category in [ 'skels', 'shells', 'backends' ]: FunctionnalTest(GETENT + [ 'config', category ], context=context).Run() commands = ( # users GETENT + [ "users" ], GETENT + [ "users", "--xml" ], GETENT + [ "users", "--long" ], GETENT + [ "users", "--long", "--xml" ], GETENT + [ "users", "--all" ], GETENT + [ "users", "--xml", "--all" ], GETENT + [ "users", "--all", "--long" ], GETENT + [ "users", "--xml", "--all", "--long" ], # groups GETENT + [ "groups" ], GETENT + [ "groups", "--xml" ], GETENT + [ "groups", "--long" ], GETENT + [ "groups", "--long", "--xml" ], GETENT + [ "groups", "--xml", "--all" ], GETENT + [ "groups", "--xml", "--all", "--long" ], GETENT + [ "groups", "--xml", "--guests" ], GETENT + [ "groups", "--xml", "--guests", "--long " ], GETENT + [ "groups", "--xml", "--responsibles" ], GETENT + [ "groups", "--xml", "--responsibles", "--long" ], GETENT + [ "groups", "--xml", "--privileged" ], GETENT + [ "groups", "--xml", "--privileged", "--long" ], # Profiles GETENT + [ "profiles" ], GETENT + [ "profiles", "--xml" ], ) for command in commands: FunctionnalTest(command, context=context) test_message('''`get` tests finished.''')
|
def test_get(context): """Test GET a lot.""" test_message('''starting get tests.''') for category in [ 'config_dir', 'main_config_file', 'extendedgroup_data_file' ]: for mode in [ '', '-s', '-b', '--bourne-shell', '-c', '--c-shell', '-p', '--php-code' ]: FunctionnalTest(GETENT + [ 'configuration', category, mode ], context=context).Run() for category in [ 'skels', 'shells', 'backends' ]: FunctionnalTest(GETENT + [ 'config', category ], context=context).Run() commands = ( # users GET + [ "users" ], GET + [ "users", "--xml" ], GET + [ "users", "--long" ], GET + [ "users", "--long", "--xml" ], GET + [ "users", "--all" ], GET + [ "users", "--xml", "--all" ], GET + [ "users", "--all", "--long" ], GET + [ "users", "--xml", "--all", "--long" ], # groups GETENT + [ "groups" ], GETENT + [ "groups", "--xml" ], GETENT + [ "groups", "--long" ], GETENT + [ "groups", "--long", "--xml" ], GETENT + [ "groups", "--xml", "--all" ], GETENT + [ "groups", "--xml", "--all", "--long" ], GETENT + [ "groups", "--xml", "--guests" ], GETENT + [ "groups", "--xml", "--guests", "--long " ], GETENT + [ "groups", "--xml", "--responsibles" ], GETENT + [ "groups", "--xml", "--responsibles", "--long" ], GETENT + [ "groups", "--xml", "--privileged" ], GETENT + [ "groups", "--xml", "--privileged", "--long" ], # Profiles GETENT + [ "profiles" ], GETENT + [ "profiles", "--xml" ], ) for command in commands: FunctionnalTest(command, context=context) test_message('''`get` tests finished.''')
| 477,996
|
def test_get(context): """Test GET a lot.""" test_message('''starting get tests.''') for category in [ 'config_dir', 'main_config_file', 'extendedgroup_data_file' ]: for mode in [ '', '-s', '-b', '--bourne-shell', '-c', '--c-shell', '-p', '--php-code' ]: FunctionnalTest(GETENT + [ 'configuration', category, mode ], context=context).Run() for category in [ 'skels', 'shells', 'backends' ]: FunctionnalTest(GETENT + [ 'config', category ], context=context).Run() commands = ( # users GETENT + [ "users" ], GETENT + [ "users", "--xml" ], GETENT + [ "users", "--long" ], GETENT + [ "users", "--long", "--xml" ], GETENT + [ "users", "--all" ], GETENT + [ "users", "--xml", "--all" ], GETENT + [ "users", "--all", "--long" ], GETENT + [ "users", "--xml", "--all", "--long" ], # groups GETENT + [ "groups" ], GETENT + [ "groups", "--xml" ], GETENT + [ "groups", "--long" ], GETENT + [ "groups", "--long", "--xml" ], GETENT + [ "groups", "--xml", "--all" ], GETENT + [ "groups", "--xml", "--all", "--long" ], GETENT + [ "groups", "--xml", "--guests" ], GETENT + [ "groups", "--xml", "--guests", "--long " ], GETENT + [ "groups", "--xml", "--responsibles" ], GETENT + [ "groups", "--xml", "--responsibles", "--long" ], GETENT + [ "groups", "--xml", "--privileged" ], GETENT + [ "groups", "--xml", "--privileged", "--long" ], # Profiles GETENT + [ "profiles" ], GETENT + [ "profiles", "--xml" ], ) for command in commands: FunctionnalTest(command, context=context) test_message('''`get` tests finished.''')
|
def test_get(context): """Test GET a lot.""" test_message('''starting get tests.''') for category in [ 'config_dir', 'main_config_file', 'extendedgroup_data_file' ]: for mode in [ '', '-s', '-b', '--bourne-shell', '-c', '--c-shell', '-p', '--php-code' ]: FunctionnalTest(GETENT + [ 'configuration', category, mode ], context=context).Run() for category in [ 'skels', 'shells', 'backends' ]: FunctionnalTest(GETENT + [ 'config', category ], context=context).Run() commands = ( # users GETENT + [ "users" ], GETENT + [ "users", "--xml" ], GETENT + [ "users", "--long" ], GETENT + [ "users", "--long", "--xml" ], GETENT + [ "users", "--all" ], GETENT + [ "users", "--xml", "--all" ], GETENT + [ "users", "--all", "--long" ], GETENT + [ "users", "--xml", "--all", "--long" ], # groups GET + [ "groups" ], GET + [ "groups", "--xml" ], GET + [ "groups", "--long" ], GET + [ "groups", "--long", "--xml" ], GET + [ "groups", "--xml", "--all" ], GET + [ "groups", "--xml", "--all", "--long" ], GET + [ "groups", "--xml", "--guests" ], GET + [ "groups", "--xml", "--guests", "--long" ], GET + [ "groups", "--xml", "--responsibles" ], GET + [ "groups", "--xml", "--responsibles", "--long" ], GET + [ "groups", "--xml", "--privileged" ], GET + [ "groups", "--xml", "--privileged", "--long" ], # Profiles GETENT + [ "profiles" ], GETENT + [ "profiles", "--xml" ], ) for command in commands: FunctionnalTest(command, context=context) test_message('''`get` tests finished.''')
| 477,997
|
def test_get(context): """Test GET a lot.""" test_message('''starting get tests.''') for category in [ 'config_dir', 'main_config_file', 'extendedgroup_data_file' ]: for mode in [ '', '-s', '-b', '--bourne-shell', '-c', '--c-shell', '-p', '--php-code' ]: FunctionnalTest(GETENT + [ 'configuration', category, mode ], context=context).Run() for category in [ 'skels', 'shells', 'backends' ]: FunctionnalTest(GETENT + [ 'config', category ], context=context).Run() commands = ( # users GETENT + [ "users" ], GETENT + [ "users", "--xml" ], GETENT + [ "users", "--long" ], GETENT + [ "users", "--long", "--xml" ], GETENT + [ "users", "--all" ], GETENT + [ "users", "--xml", "--all" ], GETENT + [ "users", "--all", "--long" ], GETENT + [ "users", "--xml", "--all", "--long" ], # groups GETENT + [ "groups" ], GETENT + [ "groups", "--xml" ], GETENT + [ "groups", "--long" ], GETENT + [ "groups", "--long", "--xml" ], GETENT + [ "groups", "--xml", "--all" ], GETENT + [ "groups", "--xml", "--all", "--long" ], GETENT + [ "groups", "--xml", "--guests" ], GETENT + [ "groups", "--xml", "--guests", "--long " ], GETENT + [ "groups", "--xml", "--responsibles" ], GETENT + [ "groups", "--xml", "--responsibles", "--long" ], GETENT + [ "groups", "--xml", "--privileged" ], GETENT + [ "groups", "--xml", "--privileged", "--long" ], # Profiles GETENT + [ "profiles" ], GETENT + [ "profiles", "--xml" ], ) for command in commands: FunctionnalTest(command, context=context) test_message('''`get` tests finished.''')
|
def test_get(context): """Test GET a lot.""" test_message('''starting get tests.''') for category in [ 'config_dir', 'main_config_file', 'extendedgroup_data_file' ]: for mode in [ '', '-s', '-b', '--bourne-shell', '-c', '--c-shell', '-p', '--php-code' ]: FunctionnalTest(GETENT + [ 'configuration', category, mode ], context=context).Run() for category in [ 'skels', 'shells', 'backends' ]: FunctionnalTest(GETENT + [ 'config', category ], context=context).Run() commands = ( # users GETENT + [ "users" ], GETENT + [ "users", "--xml" ], GETENT + [ "users", "--long" ], GETENT + [ "users", "--long", "--xml" ], GETENT + [ "users", "--all" ], GETENT + [ "users", "--xml", "--all" ], GETENT + [ "users", "--all", "--long" ], GETENT + [ "users", "--xml", "--all", "--long" ], # groups GETENT + [ "groups" ], GETENT + [ "groups", "--xml" ], GETENT + [ "groups", "--long" ], GETENT + [ "groups", "--long", "--xml" ], GETENT + [ "groups", "--xml", "--all" ], GETENT + [ "groups", "--xml", "--all", "--long" ], GETENT + [ "groups", "--xml", "--guests" ], GETENT + [ "groups", "--xml", "--guests", "--long " ], GETENT + [ "groups", "--xml", "--responsibles" ], GETENT + [ "groups", "--xml", "--responsibles", "--long" ], GETENT + [ "groups", "--xml", "--privileged" ], GETENT + [ "groups", "--xml", "--privileged", "--long" ], # Profiles GET + [ "profiles" ], GET + [ "profiles", "--xml" ], ] ScenarioTest(commands, context=context, descr="get tests").Run()
| 477,998
|
def test_regexes(): """ Try funky strings to make regexes fail (they should not).""" # TODO: test regexes directly from defs in licorn.core.... test_message('''starting regexes tests.''') regexes_commands = [] # groups related regexes_commands.extend([ ADD + [ 'group', "--name='_- -_'"], CHECK + [ 'group', "--name='_- -_'"], ADD + [ 'group', "--name=';-)'"], ADD + [ 'group', "--name='^_^'"], ADD + [ 'group', "--name='le copain des groupes'"], CHECK + [ 'group', '-v', "--name='le copain des groupes'"], ADD + [ 'group', "--name='héhéhé'"], ADD + [ 'group', "--name='%(\`ls -la /etc/passwd\`)'"], ADD + [ 'group', "--name='echo print coucou | python | nothing'"], ADD + [ 'group', "--name='**/*-'"], CHECK + [ 'group', '-v', "--name='**/*-'"] ]) # users related regexes_commands.extend([ ADD + [ 'user', "--login='_- -_'"], ADD + [ 'user', "--login=';-)'"], ADD + [ 'user', "--login='^_^'"], ADD + [ 'user', "--login='le copain des utilisateurs'"], ADD + [ 'user', "--login='héhéhé'"], ADD + [ 'user', "--login='%(\`ls -la /etc/passwd\`)'"], ADD + [ 'user', "--login='echo print coucou | python'"], ADD + [ 'user', "--login='**/*-'"] ]) for cmd in regexes_commands: FunctionnalTest(cmd).Run() # TODO: profiles ? test_message('''regexes tests finished.''')
|
def test_regexes(): """ Try funky strings to make regexes fail (they should not).""" # TODO: test regexes directly from defs in licorn.core.... test_message('''starting regexes tests.''') regexes_commands = [] # groups related regexes_commands.extend([ ADD + [ 'group', "--name='_- -_'"], CHK + [ 'group', "--name='_- -_'"], ADD + [ 'group', "--name=';-)'"], ADD + [ 'group', "--name='^_^'"], ADD + [ 'group', "--name='le copain des groupes'"], CHK + [ 'group', '-v', "--name='le copain des groupes'"], ADD + [ 'group', "--name='héhéhé'"], ADD + [ 'group', "--name='%(\`ls -la /etc/passwd\`)'"], ADD + [ 'group', "--name='echo print coucou | python | nothing'"], ADD + [ 'group', "--name='**/*-'"], CHK + [ 'group', '-v', "--name='**/*-'"] ]) # users related regexes_commands.extend([ ADD + [ 'user', "--login='_- -_'"], ADD + [ 'user', "--login=';-)'"], ADD + [ 'user', "--login='^_^'"], ADD + [ 'user', "--login='le copain des utilisateurs'"], ADD + [ 'user', "--login='héhéhé'"], ADD + [ 'user', "--login='%(\`ls -la /etc/passwd\`)'"], ADD + [ 'user', "--login='echo print coucou | python'"], ADD + [ 'user', "--login='**/*-'"] ]) for cmd in regexes_commands: FunctionnalTest(cmd).Run() # TODO: profiles ? test_message('''regexes tests finished.''')
| 477,999
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.