mirror of
https://github.com/vale981/dirkules
synced 2025-03-04 17:01:40 -05:00
samba config additions
This commit is contained in:
parent
9193652515
commit
0534b387a5
3 changed files with 21 additions and 9 deletions
12
dirkules/samba/manager.py
Normal file
12
dirkules/samba/manager.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
from dirkules import db
|
||||
|
||||
from dirkules.samba.models import SambaGlobal
|
||||
|
||||
|
||||
def set_samba_global(workgroup, name):
|
||||
SambaGlobal.query.delete()
|
||||
workgroup = SambaGlobal("workgroup", workgroup)
|
||||
name = SambaGlobal("server string", "%h {}".format(name))
|
||||
db.session.add(workgroup)
|
||||
db.session.add(name)
|
||||
db.session.commit()
|
|
@ -5,18 +5,19 @@
|
|||
{% endblock %}
|
||||
{% block body %}
|
||||
<div class="ui container">
|
||||
<t2>Feste Bestandteile der<i> Samba global conf</i></t2>
|
||||
<t2>Feste Bestandteile der<i> Samba global conf</i></t2>
|
||||
<div class="ui segment">
|
||||
{% for line in conf %}
|
||||
{{ line }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<t2>Veränderbare Bestandteile der<i> Samba global conf</i></t2>
|
||||
{% from "_formhelpers.html" import render_field %}
|
||||
<form method=post class="ui form error">
|
||||
<t2>Veränderbare Bestandteile der<i> Samba global conf</i></t2>
|
||||
{% from "_formhelpers.html" import render_field %}
|
||||
<form method=post class="ui form error">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ render_field(form.workgroup) }}
|
||||
{{ render_field(form.server_string) }}
|
||||
{{ render_field(form.submit) }}
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -3,6 +3,7 @@ from dirkules import db
|
|||
from dirkules.config import staticDir
|
||||
from flask import render_template, url_for, request, redirect
|
||||
from dirkules.samba import bp_samba
|
||||
from dirkules.samba.manager import set_samba_global
|
||||
from dirkules.samba.models import SambaShare
|
||||
from dirkules.samba.validation import SambaConfigForm, SambaAddForm
|
||||
|
||||
|
@ -17,10 +18,8 @@ def index():
|
|||
def config():
|
||||
form = SambaConfigForm(request.form)
|
||||
if request.method == 'POST' and form.validate():
|
||||
print("Input:")
|
||||
print(form.workgroup.data)
|
||||
print(form.server_string.data)
|
||||
return redirect(url_for('samba_global'))
|
||||
set_samba_global(form.workgroup.data, form.server_string.data)
|
||||
return redirect(url_for('.index'))
|
||||
file = open(staticDir + "/conf/samba_global.conf")
|
||||
conf = list()
|
||||
while True:
|
||||
|
|
Loading…
Add table
Reference in a new issue