Commit 558832ac by vuj

v0.1.1 kleine fixes README BCC/ALIAS Dropdown

1 parent 02c46817
2018-01-16 v0.1.1 kleine fixes README BCC/ALIAS Dropdown
2018-01-16 v0.1.0 migration von srvcnf =>srvcnf2 einbau des framework tornado
...@@ -14,12 +14,21 @@ Password: ...@@ -14,12 +14,21 @@ Password:
benötigte Packete benötigte Packete
apt-get install python3 libapache2-mod-python python3-sql python3-mysql.connector python3-httplib2 python3-requests python3-tornado python3-urllib3 python3-chardet python3-numpy python3-pkg-resources python3-requests python3-six python3-bcrypt python3-subprocess
apt-get install python3 libapache2-mod-python python3-sql python3-mysql.connector python3-httplib2 python3-requests python3-tornado python3-urllib3 python3-chardet python3-numpy python3-pkg-resources python3-requests python3-six python3-bcrypt
a2enmod proxy
a2enmod proxy_http
a2enmod python
*** Setup: config.ini und srvnc.sqlite3 einstellen und kopieren *** Setup: config.ini und srvnc.sqlite3 einstellen und kopieren
cp srvcnf2/setup/config.ini srvcnf2/web/base/config.ini cp srvcnf2/setup/config.ini srvcnf2/web/base/config.ini
cp srvcnf2/setup/srvcnf.sqlite3 /srvcnf2/web/ncauth/srvcnf.sqlite3 cp srvcnf2/setup/srvcnf.sqlite3 /srvcnf2/web/ncauth/srvcnf.sqlite3
ln -s /var/www/srvcnf2/setup/srvcnf2_nc.coop.conf /etc/apache2/sites-available/ ln -s /var/www/srvcnf2/setup/srvcnf2_nc.coop.conf /etc/apache2/sites-available/
/var/www/srvcnf2/setup/srvcnf2.conf & /var/www/srvcnf2/setup/srvcnf2.conf &
git update-index --assume-unchanged logs/access.log
git update-index --assume-unchanged logs/error.log
git update-index --assume-unchanged setup/srvcnf2_nc.coop.conf
...@@ -20,4 +20,8 @@ ...@@ -20,4 +20,8 @@
LogLevel warn LogLevel warn
CustomLog /var/www/srvcnf2/logs/access.log combined CustomLog /var/www/srvcnf2/logs/access.log combined
ServerSignature Off ServerSignature Off
SSLEngine On
SSLCertificateKeyFile /etc/ssl/private/domain.tld.key
SSLCertificateFile /etc/ssl/private/domain.tld.crt
SSLCertificateChainFile /etc/ssl/private/domain.tld.cer
</VirtualHost> </VirtualHost>
...@@ -8,7 +8,8 @@ import tornado.web ...@@ -8,7 +8,8 @@ import tornado.web
import tornado.escape import tornado.escape
import tornado import tornado
import os.path import os.path
from mailsrv.mailcnf_tools import mailcnf_tools
mt=mailcnf_tools()
from ncauth.ncauth_base import ncauth_base from ncauth.ncauth_base import ncauth_base
class mailcnf_alias(ncauth_base): class mailcnf_alias(ncauth_base):
...@@ -30,13 +31,15 @@ class mailcnf_alias(ncauth_base): ...@@ -30,13 +31,15 @@ class mailcnf_alias(ncauth_base):
fnc= self.get_argument("fnc", None, False) fnc= self.get_argument("fnc", None, False)
table= self.get_argument("table", None, False) table= self.get_argument("table", None, False)
domain_id= self.get_argument("domain_id", None, False) domain_id= self.get_argument("domain_id", None, False)
domaintld= self.get_argument("domaintld", None, False)
group_id= self.get_argument("group_id", None, False) group_id= self.get_argument("group_id", None, False)
source= self.get_argument("source", None, False) source= self.get_argument("source", None, False)
destination= self.get_argument("destination", None, False) destination= self.get_argument("destination", None, False)
active= self.get_argument("active", None, False) active= self.get_argument("active", None, False)
#self.write("Hello, "+str(module )+" "+str(mainfnc)+" id: "+str(id)+" fnc: "+str(fnc)+" "+str(table)+"<br>") #self.write("Hello, "+str(module )+" "+str(mainfnc)+" id: "+str(id)+" fnc: "+str(fnc)+" "+str(table)+"<br>")
uid=0 uid=0
ugroup=10 ugroup=0
combolist=mt.getDomainNamebyGuid(ugroup)
msg="" msg=""
loader =tornado. template.Loader(os.path.join(os.path.dirname(__file__), "../templates")) loader =tornado. template.Loader(os.path.join(os.path.dirname(__file__), "../templates"))
navigation=loader.load("navigation.html").generate(nav=nav) navigation=loader.load("navigation.html").generate(nav=nav)
...@@ -47,7 +50,7 @@ class mailcnf_alias(ncauth_base): ...@@ -47,7 +50,7 @@ class mailcnf_alias(ncauth_base):
msg=self.update_virtual_aliases_undelete(id); msg=self.update_virtual_aliases_undelete(id);
msglvl="alert alert-danger" msglvl="alert alert-danger"
if fnc=="submitnewalias" : if fnc=="submitnewalias" :
msg=self. insert_virtual_alias(domain_id,source,destination,active,group_id=0) msg=self. insert_virtual_alias(domaintld,source,destination,active,group_id)
msg="alias angelegt" msg="alias angelegt"
msglvl="alert alert-success" msglvl="alert alert-success"
...@@ -63,17 +66,17 @@ class mailcnf_alias(ncauth_base): ...@@ -63,17 +66,17 @@ class mailcnf_alias(ncauth_base):
subnavigation=loader.load("subnav_"+module+"_"+mainfnc+".html").generate(subnav=subnav) subnavigation=loader.load("subnav_"+module+"_"+mainfnc+".html").generate(subnav=subnav)
lists=self.edit_virtual_aliases_by_id(id, uid) lists=self.edit_virtual_aliases_by_id(id, uid)
print(lists) print(lists)
maincontent=loader.load("content_"+module+"_"+mainfnc+"_"+fnc+".html").generate(content=content, lists=lists, uid=uid, ugroup=ugroup, domain_id=domain_id) maincontent=loader.load("content_"+module+"_"+mainfnc+"_"+fnc+".html").generate(content=content, lists=lists, uid=uid, ugroup=ugroup, domain_id=domain_id, combolist=combolist)
self.render('base.html', navigation=navigation, subnavigation=subnavigation, maincontent=maincontent, msg=msg, msglvl=msglvl) self.render('base.html', navigation=navigation, subnavigation=subnavigation, maincontent=maincontent, msg=msg, msglvl=msglvl)
elif fnc=="new": elif fnc=="new":
subnavigation=loader.load("subnav_"+module+"_"+mainfnc+".html").generate(subnav=subnav) subnavigation=loader.load("subnav_"+module+"_"+mainfnc+".html").generate(subnav=subnav)
maincontent=loader.load("content_"+module+"_"+mainfnc+"_"+fnc+".html").generate(content=content,uid=uid, ugroup=ugroup, domain_id=domain_id) maincontent=loader.load("content_"+module+"_"+mainfnc+"_"+fnc+".html").generate(content=content,uid=uid, ugroup=ugroup, domain_id=domain_id, combolist=combolist)
self.render('base.html', navigation=navigation, subnavigation=subnavigation, maincontent=maincontent, msg=msg, msglvl=msglvl) self.render('base.html', navigation=navigation, subnavigation=subnavigation, maincontent=maincontent, msg=msg, msglvl=msglvl)
else: else:
subnavigation=loader.load("subnav_"+module+"_"+mainfnc+".html").generate(subnav=subnav) subnavigation=loader.load("subnav_"+module+"_"+mainfnc+".html").generate(subnav=subnav)
lists=self.print_virtual_domain_id('','',uid) lists=self.print_virtual_domain_id('','',uid)
maincontent=loader.load("content_"+module+"_"+mainfnc+".html").generate(content=content, lists=lists) maincontent=loader.load("content_"+module+"_"+mainfnc+".html").generate(content=content, lists=lists, combolist=combolist)
self.render('base.html', navigation=navigation, subnavigation=subnavigation, maincontent=maincontent, msg=msg, msglvl=msglvl) self.render('base.html', navigation=navigation, subnavigation=subnavigation, maincontent=maincontent, msg=msg, msglvl=msglvl)
def getUsers(self): def getUsers(self):
...@@ -128,7 +131,10 @@ class mailcnf_alias(ncauth_base): ...@@ -128,7 +131,10 @@ class mailcnf_alias(ncauth_base):
def insert_virtual_alias(self,domain_id,source,destination,active,group_id=0): def insert_virtual_alias(self,domaintld,source,destination,active,group_id=0):
domain_id= str(mt.get_domain_id_by_name(domaintld))
source= source+'@'+domaintld
query = "INSERT INTO virtual_aliases(domain_id,source,destination,active,group_id) VALUE('"+str(domain_id)+"','"+str(source)+"','"+str(destination)+"','"+str(active)+"','"+str(group_id)+"');" query = "INSERT INTO virtual_aliases(domain_id,source,destination,active,group_id) VALUE('"+str(domain_id)+"','"+str(source)+"','"+str(destination)+"','"+str(active)+"','"+str(group_id)+"');"
#self.write(query) #self.write(query)
# args = (domain_id,password,email,sent_mail,active) # args = (domain_id,password,email,sent_mail,active)
......
...@@ -8,7 +8,8 @@ import tornado.web ...@@ -8,7 +8,8 @@ import tornado.web
import tornado.escape import tornado.escape
import tornado import tornado
import os.path import os.path
from mailsrv.mailcnf_tools import mailcnf_tools
mt=mailcnf_tools()
from ncauth.ncauth_base import ncauth_base from ncauth.ncauth_base import ncauth_base
class mailcnf_bcc(ncauth_base): class mailcnf_bcc(ncauth_base):
...@@ -30,13 +31,15 @@ class mailcnf_bcc(ncauth_base): ...@@ -30,13 +31,15 @@ class mailcnf_bcc(ncauth_base):
fnc= self.get_argument("fnc", None, False) fnc= self.get_argument("fnc", None, False)
# table= self.get_argument("table", None, False) # table= self.get_argument("table", None, False)
domain_id= self.get_argument("domain_id", None, False) domain_id= self.get_argument("domain_id", None, False)
domaintld= self.get_argument("domaintld", None, False)
group_id= self.get_argument("group_id", None, False) group_id= self.get_argument("group_id", None, False)
source= self.get_argument("source", None, False) source= self.get_argument("source", None, False)
destination= self.get_argument("destination", None, False) destination= self.get_argument("destination", None, False)
active= self.get_argument("active", None, False) active= self.get_argument("active", None, False)
#self.write("Hello, "+str(module )+" "+str(mainfnc)+" id: "+str(id)+" fnc: "+str(fnc)+" "+str(table)+"<br>") #self.write("Hello, "+str(module )+" "+str(mainfnc)+" id: "+str(id)+" fnc: "+str(fnc)+" "+str(table)+"<br>")
uid=0 uid=0
ugroup=10 ugroup=0
combolist=mt.getDomainNamebyGuid(ugroup)
msg="" msg=""
loader =tornado. template.Loader(os.path.join(os.path.dirname(__file__), "../templates")) loader =tornado. template.Loader(os.path.join(os.path.dirname(__file__), "../templates"))
navigation=loader.load("navigation.html").generate(nav=nav) navigation=loader.load("navigation.html").generate(nav=nav)
...@@ -47,7 +50,7 @@ class mailcnf_bcc(ncauth_base): ...@@ -47,7 +50,7 @@ class mailcnf_bcc(ncauth_base):
msg=self.update_virtual_bccs_undelete(id); msg=self.update_virtual_bccs_undelete(id);
msglvl="alert alert-danger" msglvl="alert alert-danger"
if fnc=="submitnewbcc" : if fnc=="submitnewbcc" :
msg=self. insert_virtual_bcc(domain_id,source,destination,active,group_id=0) msg=self. insert_virtual_bcc(domaintld,source,destination,active,group_id)
msg="BCC angelegt" msg="BCC angelegt"
msglvl="alert alert-success" msglvl="alert alert-success"
...@@ -68,12 +71,12 @@ class mailcnf_bcc(ncauth_base): ...@@ -68,12 +71,12 @@ class mailcnf_bcc(ncauth_base):
elif fnc=="new": elif fnc=="new":
subnavigation=loader.load("subnav_"+module+"_"+mainfnc+".html").generate(subnav=subnav) subnavigation=loader.load("subnav_"+module+"_"+mainfnc+".html").generate(subnav=subnav)
maincontent=loader.load("content_"+module+"_"+mainfnc+"_"+fnc+".html").generate(content=content,uid=uid, ugroup=ugroup, domain_id=domain_id) maincontent=loader.load("content_"+module+"_"+mainfnc+"_"+fnc+".html").generate(content=content,uid=uid, ugroup=ugroup, domain_id=domain_id, combolist=combolist)
self.render('base.html', navigation=navigation, subnavigation=subnavigation, maincontent=maincontent, msg=msg, msglvl=msglvl) self.render('base.html', navigation=navigation, subnavigation=subnavigation, maincontent=maincontent, msg=msg, msglvl=msglvl)
else: else:
subnavigation=loader.load("subnav_"+module+"_"+mainfnc+".html").generate(subnav=subnav) subnavigation=loader.load("subnav_"+module+"_"+mainfnc+".html").generate(subnav=subnav)
lists=self.print_virtual_domain_id('','',uid) lists=self.print_virtual_domain_id('','',uid)
maincontent=loader.load("content_"+module+"_"+mainfnc+".html").generate(content=content, lists=lists) maincontent=loader.load("content_"+module+"_"+mainfnc+".html").generate(content=content, lists=lists, combolist=combolist)
self.render('base.html', navigation=navigation, subnavigation=subnavigation, maincontent=maincontent, msg=msg, msglvl=msglvl) self.render('base.html', navigation=navigation, subnavigation=subnavigation, maincontent=maincontent, msg=msg, msglvl=msglvl)
def getUsers(self): def getUsers(self):
...@@ -128,7 +131,9 @@ class mailcnf_bcc(ncauth_base): ...@@ -128,7 +131,9 @@ class mailcnf_bcc(ncauth_base):
def insert_virtual_bcc(self,domain_id,source,destination,active,group_id=0): def insert_virtual_bcc(self,domaintld,source,destination,active,group_id=0):
domain_id= str(mt.get_domain_id_by_name(domaintld))
source= source+'@'+domaintld
query = "INSERT INTO virtual_recipients_bcc(domain_id,source,destination,active,group_id) VALUE('"+str(domain_id)+"','"+str(source)+"','"+str(destination)+"','"+str(active)+"','"+str(group_id)+"');" query = "INSERT INTO virtual_recipients_bcc(domain_id,source,destination,active,group_id) VALUE('"+str(domain_id)+"','"+str(source)+"','"+str(destination)+"','"+str(active)+"','"+str(group_id)+"');"
#self.write(query) #self.write(query)
# args = (domain_id,password,email,sent_mail,active) # args = (domain_id,password,email,sent_mail,active)
......
<div>
{{ gitlastchange }}
</div>
<div>
{{ gitversions }}
</div>
<br>
<br>
<div class="alert-info" style="alert">letzte &Auml;nderungen:</div>
<div> <div>
{% raw gitlastchange %} {% raw gitlastchange %}
</div> </div>
<br><br>
<div class="alert-info" style="alert">Versionen:</div>
<div> <div>
{% raw gitversions %} {% raw gitversions %}
</div> </div>
...@@ -15,19 +15,17 @@ ...@@ -15,19 +15,17 @@
</td> </td>
</tr> </tr>
<tr>
<td>Domain ID:</td>
<td>
{% if uid== 0 %}
<input type="text" size="70" name="domain_id" value="{{ domain_id }}">
{% else %}
<input type="text" size="70" name="domain_id" value="{{ domain_id }}" readonly>
{% end %}
</td>
</tr>
<tr> <tr>
<td>Source: </td> <td>Source: </td>
<td><input type="text" size="70" name="source" value=""> <td><input type="text" size="40" name="source" value="">@
<select name="domaintld" size="1">
{% for entry in combolist %}
<option>{{ escape(entry) }}</option>
{% end %}
</select>
</tr> </tr>
<td>Destination: </td> <td>Destination: </td>
<td><input type="text" size="70" name="destination" value=""> <td><input type="text" size="70" name="destination" value="">
......
...@@ -15,20 +15,17 @@ ...@@ -15,20 +15,17 @@
</td> </td>
</tr> </tr>
<tr>
<td>Domain ID:</td>
<td>
{% if uid== 0 %}
<input type="text" size="70" name="domain_id" value="{{ domain_id }}">
{% else %}
<input type="text" size="70" name="domain_id" value="{{ domain_id }}" readonly>
{% end %}
</td>
</tr>
<tr>
<tr> <tr>
<td>Source: </td> <td>Source: </td>
<td><input type="text" size="70" name="source" value=""> <td><input type="text" size="40" name="source" value="">@
<select name="domaintld" size="1">
{% for entry in combolist %}
<option>{{ escape(entry) }}</option>
{% end %}
</select>
</tr> </tr>
<td>Destination: </td> <td>Destination: </td>
<td><input type="text" size="70" name="destination" value=""> <td><input type="text" size="70" name="destination" value="">
......
...@@ -32,8 +32,7 @@ ...@@ -32,8 +32,7 @@
<select name="domaintld" size="1"> <select name="domaintld" size="1">
{% for entry in combolist %} {% for entry in combolist %}
<option>{{ escape(entry) }}</option> <option>{{ escape(entry) }}</option>
{% end %} {% end %}
</select> </select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!