def edit_auth_method(request): return_dict = {} try: try : d = samba_settings.load_auth_settings() except Exception, e: return_dict["error"] = "Error loading authentication configuration - %s" %e return django.shortcuts.render_to_response('logged_in_error.html', return_dict, context_instance=django.template.context.RequestContext(request)) return_dict["samba_global_dict"] = d if request.method == "GET": return django.shortcuts.render_to_response('edit_auth_method.html', return_dict, context_instance=django.template.context.RequestContext(request)) else: #Save request if "auth_method" not in request.POST: return_dict["error"] = "Please select an authentication method" return django.shortcuts.render_to_response('edit_auth_method.html', return_dict, context_instance=django.template.context.RequestContext(request)) security = request.POST["auth_method"] if security == d["security"]: return_dict["error"] = "Selected authentication method is the same as before." return django.shortcuts.render_to_response('edit_auth_method.html', return_dict, context_instance=django.template.context.RequestContext(request)) try: samba_settings.change_auth_method(security) samba_settings.generate_smb_conf() except Exception, e: return_dict["error"] = "Error updating authentication method - %s" %e return django.shortcuts.render_to_response('logged_in_error.html', return_dict, context_instance=django.template.context.RequestContext(request))
def samba_server_settings(request): return_dict = {} #print 'a1' try: try : #print 'a' d = samba_settings.load_auth_settings() #print 'b' except Exception, e: return_dict["error"] = "Error loading authentication configuration - %s" %e return django.shortcuts.render_to_response('logged_in_error.html', return_dict, context_instance=django.template.context.RequestContext(request)) if "action" in request.REQUEST and request.REQUEST["action"] == "edit": ini = {} if d: for k in d.keys(): ini[k] = d[k] if d and d["security"] == "ads": form = samba_shares_forms.AuthADSettingsForm(initial=ini) #elif d["security"] == "users": else: #print 'c' form = samba_shares_forms.AuthUsersSettingsForm(initial=ini) #print 'd' return_dict["form"] = form return django.shortcuts.render_to_response('edit_samba_server_settings.html', return_dict, context_instance=django.template.context.RequestContext(request)) # Else a view request return_dict["samba_global_dict"] = d #print 'a2' if "action" in request.REQUEST and request.REQUEST["action"] == "saved": return_dict["conf"] = "Information updated successfully" return django.shortcuts.render_to_response('view_samba_server_settings.html', return_dict, context_instance=django.template.context.RequestContext(request))
def edit_auth_method(request): return_dict = {} try: try: d = samba_settings.load_auth_settings() except Exception, e: return_dict[ "error"] = "Error loading authentication configuration - %s" % e return django.shortcuts.render_to_response( 'logged_in_error.html', return_dict, context_instance=django.template.context.RequestContext( request)) return_dict["samba_global_dict"] = d if request.method == "GET": return django.shortcuts.render_to_response( 'edit_auth_method.html', return_dict, context_instance=django.template.context.RequestContext( request)) else: #Save request if "auth_method" not in request.POST: return_dict["error"] = "Please select an authentication method" return django.shortcuts.render_to_response( 'edit_auth_method.html', return_dict, context_instance=django.template.context.RequestContext( request)) security = request.POST["auth_method"] if security == d["security"]: return_dict[ "error"] = "Selected authentication method is the same as before." return django.shortcuts.render_to_response( 'edit_auth_method.html', return_dict, context_instance=django.template.context.RequestContext( request)) try: samba_settings.change_auth_method(security) samba_settings.generate_smb_conf() except Exception, e: return_dict[ "error"] = "Error updating authentication method - %s" % e return django.shortcuts.render_to_response( 'logged_in_error.html', return_dict, context_instance=django.template.context.RequestContext( request))
def samba_server_settings(request): return_dict = {} #print 'a1' try: try: #print 'a' d = samba_settings.load_auth_settings() #print 'b' except Exception, e: return_dict[ "error"] = "Error loading authentication configuration - %s" % e return django.shortcuts.render_to_response( 'logged_in_error.html', return_dict, context_instance=django.template.context.RequestContext( request)) if "action" in request.REQUEST and request.REQUEST["action"] == "edit": ini = {} if d: for k in d.keys(): ini[k] = d[k] if d and d["security"] == "ads": form = samba_shares_forms.AuthADSettingsForm(initial=ini) #elif d["security"] == "users": else: #print 'c' form = samba_shares_forms.AuthUsersSettingsForm(initial=ini) #print 'd' return_dict["form"] = form return django.shortcuts.render_to_response( 'edit_samba_server_settings.html', return_dict, context_instance=django.template.context.RequestContext( request)) # Else a view request return_dict["samba_global_dict"] = d #print 'a2' if "action" in request.REQUEST and request.REQUEST["action"] == "saved": return_dict["conf"] = "Information updated successfully" return django.shortcuts.render_to_response( 'view_samba_server_settings.html', return_dict, context_instance=django.template.context.RequestContext(request))