浏览代码

aggiornamento in corso, ma non so di cosa

mauro 5 月之前
父节点
当前提交
3674ebc69d

+ 1 - 0
alias/templates/Alias.List.html

@@ -22,6 +22,7 @@
     {% if not 'EDITALIASNEW' in securitlist %}
     <button class="btn btn-primary" type="submit" name='Nuovo alias' value="Nuovo alias">Nuovo Alias</button>
     {% endif %}
+    <button class="btn btn-primary" type="submit" name="IndietroButton" value="IndietroButton">Indietro</button>
   </form>
   <table class='table table-striped table-hover'>
     <thead class='thead-dark'>

+ 3 - 0
alias/views.py

@@ -51,6 +51,9 @@ def AliasList(request):
       #return  HttpResponseRedirect(reverse('Alias:AliasNew',args={}))
       return HttpResponseRedirect(reverse('Alias:AliasEdit',args=[]))
 
+    if "IndietroButton" in request.POST:
+      return HttpResponseRedirect(reverse('Domini:DomainServizi'))
+
     if "edit" in request.POST:
       print('id da editare',request.POST['edit'])
       request.session['_alias2edit_'] = request.POST['edit']

+ 5 - 4
comunicazioni/views.py

@@ -822,7 +822,7 @@ def CheckQuotaMail(request,dominio=None,mail=None,quota=None):
           print('len',len(u))
           u = u[0]
           print('Trovato',d.nome,u.id,int(quota))
-          u.quota = int(quota)
+          u.mail_quota = int(quota)
           u.save()
 
       result = d.user_set.all().aggregate(Sum('mail_quota'))
@@ -833,7 +833,7 @@ def CheckQuotaMail(request,dominio=None,mail=None,quota=None):
       d.date_mail_quota = date.today()
       d.last_mail_check = True
 
-      if result['quota__sum']:
+      if result['mail_quota__sum']:
         d.mail_quota = result['mail_quota__sum']
       #else: 
       #  d.mail_quota = 0
@@ -928,9 +928,9 @@ def CheckQuotaFtp(request,dominio=None,ftp=None,quota=None):
       f = FTPUser.objects.filter(dominio=d.id,utente=ftp,tobedeleted=False)
       if len(f) == 1:
         f = f[0]
-        f.quota = int(quota)
+        f.ftp_quota = int(quota)
         f.save()
-      result = d.ftpuser_set.filter().filter(ftpgroup__section='ftp').aggregate(Sum('quota'))
+      result = d.ftpuser_set.filter().filter(ftpgroup__section='ftp').aggregate(Sum('ftp_quota'))
       d.last_ftp_quota = d.ftp_quota
       d.date_ftp_quota = date.today()
 
@@ -1029,6 +1029,7 @@ def OccupazioneControlloQuota(request,dominio=None):
   mq.build('topic','messaggio/quota')
   mq.build('richiesta','quota')
   mq.build('stampa',True)
+
   tmp = dict()
   tmp['dtask'] = dtask
   tmpdom = list()

+ 2 - 0
database/forms.py

@@ -22,6 +22,8 @@ class formSqlDatabase(forms.Form):
     self.fields['mail'] = forms.CharField(required=False)
     self.fields['mail_send'] = forms.BooleanField(required=False,initial=False)
     self.fields['password_last_update'] = forms.BooleanField(required=False)
+    self.fields['sql_quota'] = forms.IntegerField(required=False)
+    self.fields['date_sql_quota'] = forms.DateField(required=False)
   # lista dei mail server disponibili
   def listsqlserver(self):
     _sqlserver = []

+ 2 - 1
database/models.py

@@ -26,7 +26,8 @@ class SqlDatabase(models.Model):
   enabled = models.BooleanField(db_column='enabled',default=1)
   locked = models.BooleanField(db_column='locked',default=0)
   tobedeleted= models.BooleanField(db_column='tobedeleted',default=0)
-  quota = models.IntegerField(db_column='quota',default=0)
+  sql_quota = models.IntegerField(db_column='sql_quota',default=0)
+  date_sql_quota = models.DateField(db_column='date_sql_quota',blank=True)
   aggiornamento = models.DateTimeField(db_column='aggiornamento',max_length=20)
   creazione = models.DateTimeField(db_column='creazione')
   nota = models.TextField(db_column='nota',default='')

+ 2 - 1
database/views.py

@@ -685,7 +685,8 @@ def SqlDatabaseEdit(request):
   tmp['tobedeleted'] = sqldatabase.tobedeleted
   tmp['locked'] = sqldatabase.locked
   print('locked',sqldatabase.locked)
-  tmp['quota'] = sqldatabase.quota
+  tmp['sql_quota'] = sqldatabase.sql_quota
+  tmp['date_sql_quota'] = sqldatabase.date_sql_quota
   tmp['password_last_update'] = sqldatabase.password_last_update
   tmp['creazione'] = sqldatabase.creazione
   tmp['aggiornamento'] = sqldatabase.aggiornamento

+ 3 - 1
domini/templates/gestione.domain.show.html

@@ -202,6 +202,7 @@
         <th>Utente</th>
 	<th>Home</th>
 	<th>Quota</th>
+	<th>Ril.</th>
       </tr>
     </thead>
     <tbody>
@@ -209,7 +210,8 @@
       <tr>
 	      <td>{{ f.utente }}</td>
 	      <td>{{ f.homedir }}</td>
-	      <td>{{ f.quota|intcomma }}M</td>
+	      <td>{{ f.ftp_quota|intcomma }}M</td>
+	      <td>{{ f.date_ftp_quota }}</td>
      </tr>
     {% endfor %}
     </tbody>

+ 2 - 2
ftp/models.py

@@ -53,9 +53,9 @@ class FTPUser(models.Model):
   account_expire = models.BooleanField(db_column='account_expire')
   account_creation = models.DateField(db_column='account_creation')
   tobedeleted = models.BooleanField(db_column='tobedeleted')
-  quota = models.IntegerField(db_column='quota')
+  ftp_quota = models.IntegerField(db_column='ftp_quota')
+  date_ftp_quota = models.DateField(db_column='date_ftp_quota',blank=True)
   ftpgroup = models.ForeignKey('FTPGroup',db_column='ftp_home',on_delete=models.PROTECT)
-  last_ftp_checked = models.DateField(db_column='last_ftp_checked')
   mail = models.CharField(db_column='mail',max_length=128)
   #sezione relativa alle configurazioni di pubblicazione (proxy,http,spazio e cert.ssl) via mqtt
   #httpserver = models.ForeignKey('httpserver.HttpServer',db_column='httpserver',on_delete=models.PROTECT)

+ 1 - 1
ftp/templates/Ftp.Edit.html

@@ -227,7 +227,7 @@ function getJsonPassword() {
         <div class='row'>
           <div class='col'>
             <label for='quota'>Quota (in Mb):</label>
-            <input type='text' class='form-control' id='quota' name='quota' value='{{ ftp.quota }}' placeholder='0' readonly=''>
+            <input type='text' class='form-control' id='ftp_quota' name='quota' value='{{ ftp.ftp_quota }}' placeholder='0' readonly=''>
           </div>
           <div class='col'>
             <label for='warning_mail_quota'>Spazio suggerito (in Mb):</label>

+ 4 - 2
ftp/templates/Ftp.List.html

@@ -38,6 +38,7 @@
 	<th scope='col'>M</th>
         <th scope='col'>l</th>
         <th scope='col'>quota</th>
+	<th scope='col'>Ril.</th>
         <th scope='col'>Attivit<C3><A0></th>
       </tr>
     </thead>
@@ -63,8 +64,9 @@
           <td>{% if u.enabled %}*{% else %}-{% endif %}</td>
 	  <td>{% if u.ftpgroup.master %}M{% else %}-{% endif %}</td>
           <td>{{ u.securitylevel.id }}</td>
-	  <td>{{ u.quota }}Mb {% if u.warning_ftp_quota %} /{{ u.warning_ftp_quota }}Mb{% else %}{% endif %}
-		  <td>{% if 'FTPEDIT' in securitylist %}<button class="btn btn-primary" type="submit" name='Edit' value="{{ u.id }}"{% if not u.enabled %} disabled {% endif %}>Edit</button>{% endif %}
+	  <td>{{ u.ftp_quota }}Mb {% if u.warning_ftp_quota %} /{{ u.warning_ftp_quota }}Mb{% else %}{% endif %}
+	  <td>{{ u.date_ftp_quota }}</td>
+	  <td>{% if 'FTPEDIT' in securitylist %}<button class="btn btn-primary" type="submit" name='Edit' value="{{ u.id }}"{% if not u.enabled %} disabled {% endif %}>Edit</button>{% endif %}
               <button class='btn btn-primary' type='button' data-toggle='modal' data-target='#ConfirmEnableDisable{{ u.id }}' name='enabledisablebutton' value='{{ u.id }}'>{% if u.enabled %}Disabilita{% else %}Abilita{% endif %}</button>
 	      {% if 'FTPBACK' in securitylist %}<button type 'submit' class='btn btn-secondary' name='BackupFTPHTTP' value='{{ u.id }}'>Backup FTP e HTTP</button>{% endif %}</td>
    </tr>

+ 9 - 7
static/basic/base.html

@@ -16,13 +16,16 @@
   <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
   <-script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
   -->
-
+  <meta charset='utf-8'>
   <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+
   {% block headersupplement %}
 
   {% endblock %}
 </head>
+
 <body style='padding-top:100px; padding-bottom:50px;'> <!-- occhio, che non prende css/style.css -->
+
 {% if navbar %}
 <!--logo altemica e navbar-->
 <nav class="navbar fixed-top navbar-expand-lg navbar-light bg-light">
@@ -59,13 +62,12 @@
       </li>
     </ul>
   </div>  
-  </nav>
+</nav>
 {% endif %}
 <!-- se navbar e' presente con un 1 all'interno, viene visualizza la navbar -->
 
-<div class="col-md-3 col-sm-3 col-xs-3">&nbsp;</div>
- 
-<div class='container'>
+
+<div class='container-xxl'>
     {% block top %}
       <p>
     Utente che sta effettuando gli aggiornamenti {{ utenteautorizzato.mail }}@{{ utenteautorizzato.domain.nome }}
@@ -89,13 +91,13 @@
     {% endblock %}
 </div>
 
-<div class='container'>
+<div class='container-xxl'>
       {% block body %}
         Place Holder
       {% endblock %}
 </div>
 
-<div class='container'>
+<div class='container-xxl'>
       {% block bodybottom %}
       {% endblock %}
 </div>

+ 13 - 10
utenti/templates/Utente.List.html

@@ -4,7 +4,7 @@
 {% block body %}
   <form name='newdomain' method='post'>
     {% csrf_token %}
-    {% if not 'EDITUSERNEW' in securitylist %}
+    {% if 'EDITUSERNEW' in securitylist %}
     <button class="btn btn-primary" type="submit" name='Nuova Email' value="Nuova Email">Nuova Email</button>
     {% endif %}
     <button class="btn btn-secondary" type="submit" name='Lista Email' value="Lista Email">Lista Stampabile Email</button>
@@ -18,14 +18,15 @@
   <table class='table table-striped table-hover'>
     <thead class='thead-dark'>
       <tr>
-        <th scope='col'>#</th>
         <th scope='col'>Mail</th>
         <th scope='col'>Nome</th>
         <th scope='col'>*</th>
         <th scope='col'>l</th>
         <th scope='col'>Quota/Warn/Limit</th>
+	<th scope='col'>Ril</th>
         <th scpèe='col'>Agg.Pass</th>
-        <th scope='col'>Attività</th>
+        <th scope='col'>Attivita</th>
+	<th scope='col'>Server</th>
       </tr>
     </thead>
     <tbody>
@@ -33,19 +34,21 @@
       {% csrf_token %}
       {% for u in userlist %}
         <tr class='{% if not u.enabled %} table-dark {% else %} {% endif %}' {% if u.securitylevel.id == 5 %}*{% endif %}>
-	<td> {{ u.id }} {% if u.securitylevel.id == 5 %} * {% endif %}</td>
-	<td {% if 'USERSHOWPASSWORD' in securitylist %} data-toggle='tooltip' title='{{ u.clear }}' {% endif %}> {{ u.mail }} </td>
+		<td class="fw-bold" {% if 'USERSHOWPASSWORD' in securitylist %} data-toggle='tooltip' data-html='true' title='{{ u.clear }}' {% endif %}>{{ u.mail }}</td>
         <td> {{ u.nome }} </td>
         <td>{% if u.enabled %}*{% else %}-{% endif %}</td>
 	<td>{{ u.securitylevel.id }}</td>
-	<td>{{ u.mail_quota }}Mb/{% if u.warning_mail_quota == 0 %}--{% else %}{{ u.warning_mail_quota }}{% endif %}Mb/{% if u.limit_mail_quota == 0 %}--{% else %}{{ u.limit_mail_quota }}{% endif %}Mb
+	<td>{{ u.mail_quota }}Mb/{% if u.warning_mail_quota == 0 %}--{% else %}{{ u.warning_mail_quota }}{% endif %}Mb/{% if u.limit_mail_quota == 0 %}--{% else %}{{ u.limit_mail_quota }}{% endif %}Mb</td>
+        <td>{{ u.date_mail_quota }}</td>
         <td>{% if u.last_password_update %}{{ u.last_password_update }}{% endif %}</td>
 	<td><button class='btn btn-primary' type="submit" name='editbutton' value="{{ u.id }}"{% if not u.enabled %} disabled {% endif %}{% if u.tobedeleted %} disabled {% endif %}>Edit</button>
 	<button class='btn btn-primary' type='button' data-toggle='modal' data-target='#ConfirmEnableDisable{{ u.id }}' name='enabledisablebutton' value='{{ u.id }}' {% if u.tobedeleted %} disabled {% endif %}> {% if u.enabled %}Disabilita{% else %}Abilita{% endif %}</button>
-	    <button class='btn btn-primary' type='submit' name='enablepassword' value='{{ u.id }}' {% if u.enabled %} disabled {% endif %}{% if u.tobedeleted %} disabled {% endif %}>Enable & Password</button>
-	    <button class='btn btn-primary' data-toggle='modal' data-target='#ConfirmToBeDeleted{{ u.id }}' type='button' name='tobedeletedbutton' value='{{ u.id }}' {% if u.enabled %} disabled {% endif %}>{% if u.tobedeleted %}In Cancellazione{% else %}Cancellabile{% endif %}</button>
-	<button type='submit' class='btn btn-primary' name='sendInfoToAdmin' id='sendInfoToAdmin' value='{{ u.id }}' >Invia Info ad Admin</button>
+	    <button class='btn btn-primary' type='submit' name='enablepassword' value='{{ u.id }}' {% if u.enabled %} disabled {% endif %}{% if u.tobedeleted %} disabled {% endif %}>abilita & nuova Pass</button>
+	    <button class='btn btn-primary' data-toggle='modal' data-target='#ConfirmToBeDeleted{{ u.id }}' type='button' name='tobedeletedbutton' value='{{ u.id }}' {% if u.enabled %} disabled {% endif %}>{% if u.tobedeleted %}In Cancellazione{% else %}Da Rimuovere{% endif %}</button>
+	<button type='submit' class='btn btn-primary' name='sendInfoToAdmin' id='sendInfoToAdmin' value='{{ u.id }}' >Info ad Admin</button>
 	</td>
+	<td> {{ u.mail_server.id }}: {{ u.mail_server.nome }}</td>
+	
       </tr>
       <!-- Modal -->
       <div class="modal fade" id="ConfirmEnableDisable{{ u.id }}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
@@ -72,7 +75,7 @@
         </div>
       </div>
     </tbody>
-    {{ securitylist }}
+
       <!-- Modal -->
       <div class="modal fade" id="ConfirmToBeDeleted{{ u.id }}" tabindex="-1" role="dialog" aria-labelledby="elemento da impostare per la cancellazione" aria-hidden="true">
         <div class="modal-dialog" role="document">

+ 3 - 2
utenti/templates/Utente.ReadOnlyList.html

@@ -13,8 +13,8 @@
         <th scope='col'>quota</th>
 	{% if 'XUSERSHOWCLEARPASSWORD' in securitylist %}<th scope='col'>Password</th>{% endif %}
 	<th scope='col'>Agg.Pas</th>
-	<!--<th scope='col'>Attivo</th>
-	<th scope='col'>Da cancellare</th>-->
+	<th scope='col'>Server</th>
+	<!--<th scope='col'>Da cancellare</th>-->
       </tr>
     </thead>
     <tbody>
@@ -29,6 +29,7 @@
 	<td>{{ u.mail_quota }}Mb/{% if u.warning_mail_quota %}{{ u.warning_mail_quota }}Mb{% else %}--{% endif %}
 		{% if 'XUSERSHOWCLEARPASSWORD' in securitylist %} <td>{{ u.clear }}</td> {% endif %} 
         <td>{% if u.last_password_update %}{{ u.last_password_update }}{% endif %}</td>
+	<td>{{ u.mail_server.nome  }}</td>
         <!--<td>{% if not u.enabled %}Utente Disattivato {% else %} {% endif %}</td>
 	<td>{% if u.tobedeleted %}In Cancellazione {% else %} {% endif %} </td>-->
       </tr>

+ 16 - 5
utenti/views.py

@@ -55,7 +55,8 @@ def UserList(request):
   print("livello autorizzazione",utenteautorizzato.securitylevel_id)
   securitylevel = getSecurityLevel(utenteautorizzato.securitylevel_id)
   securityrow = getSecurityRow(utenteautorizzato.securitylevel_id)
-
+  securitylist = getSecurityList(securityrow)
+  value['securitylist'] = securitylist
   value['securityrow'] = securityrow
   value['securityrowLen'] = len(securityrow)
   value['CANWRITE']=True #per il momento, questo flag serve a capire se e' un record nuovo
@@ -281,10 +282,10 @@ def UserEdit(request):
   securitylevel = getSecurityLevel(utenteautorizzato.securitylevel_id)
   securityrow = getSecurityRow(utenteautorizzato.securitylevel_id)
   securitylist = getSecurityList(securityrow)
+
   value['securityrow'] = securityrow
   value['securityrowLen'] = len(securityrow)
   value['securitylist'] = securitylist
-
   value['mail_password_length']=getConfigurazione('mail_password_length')
   value['mail_password_message'] = getConfigurazione('mail_password_message')
   
@@ -469,6 +470,7 @@ def UserEdit(request):
         mq.pubblica()
         tmp=None
 
+
         return HttpResponseRedirect(reverse('Utenti:UserList'))
       try:
         record.save()
@@ -478,8 +480,6 @@ def UserEdit(request):
         # quesito: come faccio a tornare alla pagina orginale?
         return HttpResponseRedirect(reverse(_from_,args={}))
 
-
-
       '''
       salvato il record, provvediamo anche a inviare i dati per mqtt per i server remoti
       l'operazione viene eseguita solo se sql_remote e' diverso da 0
@@ -557,12 +557,22 @@ def UserEdit(request):
         tmp=None
         mq = None
 
+      ''' salvato il record, provvediamo anche a fare il flush delle autenticazioni.
+      '''
+      print('send request flush')
+      mq = mqtt()
+      mq.build('stampa',True)
+      mq.build('topic','richiesta/mail')
+      mq.build('richiesta','dovecot/auth/cache/flush')
+      #mq.build('data',tmp)
+      mq.pubblica()
+
       user2edit = record.id
       request.session['_user2edit_'] = user2edit
       # quesito: come faccio a tornare alla pagina orginale?
       return HttpResponseRedirect(reverse(_from_,args={}))
       # pero' non vale, nel caso non dovessi dover tornare alla lista?
-      # stavp giusto pensando di inviare il referer, per far capire dove tornare.
+      # stavo giusto pensando di inviare il referer, per far capire dove tornare.
     else:
       print("formemail.is_valid non passato")
       print("formemail.errors")
@@ -592,6 +602,7 @@ def UserEdit(request):
     temp['nome'] = record.nome
     temp['dominio'] = record.domain_id
     temp['dominio_domain'] = record.domain.nome
+    print('record.clear',record.clear)
     temp['password1'] = record.clear
     temp['password2'] = record.clear
     temp['clear'] = record.clear