Commits

Zhang Huangbin committed a33dd21

Sync.

Comments (0)

Files changed (5)

controllers/ldap/user.py

 
             accountList = sl.get('accountList', [])
 
-            ############################
-            # Get real-time used quota.
-            #
-            # Pre-defined dict of account used quota.
-            accountUsedQuota = {}
-
-            if session.get('enableShowUsedQuota', False) is True:
-                # Get email address list.
-                accountEmailLists = []
-                for tmpuser in accountList:
-                    accountEmailLists += tmpuser[1].get('mail', [])
-
-                if len(accountEmailLists) > 0:
-                    try:
-                        accountUsedQuota = iredutils.getAccountUsedQuota(accountEmailLists)
-                    except Exception, e:
-                        pass
-            #
-            # END. Get real-time used quota.
-            ################################
-
             if cur_page > sl.get('totalPages'):
                 cur_page = sl.get('totalPages')
 
                 cur_domain=domain,
                 allDomains=allDomains,
                 showLoginDate=showLoginDate,
-                accountUsedQuota=accountUsedQuota,
+                accountUsedQuota={},
                 msg=i.get('msg'),
             )
         else:
         userLib = user.User()
         result = userLib.profile(domain=self.cur_domain, mail=self.mail)
         if result[0] is True:
-            if self.profile_type == 'general':
-                # Get account used quota.
-                if session.get('enableShowUsedQuota') is True:
-                    try:
-                        accountUsedQuota = iredutils.getAccountUsedQuota([self.mail])
-                    except Exception, e:
-                        pass
-
-            elif self.profile_type == 'password':
+            if self.profile_type == 'password':
                 # Get accountSetting of current domain.
                 domainLib = domainlib.Domain()
                 result_setting = domainLib.getDomainAccountSetting(domain=self.cur_domain)
 # Get global language setting.
 lang = cfg.general.get('lang', 'en_US')
 
-#####################################
-# Store all 'true/false' in session.
-#
-# Get value of 'show_used_quota' in [general].
-if backend == 'mysql':
-    enableShowUsedQuota = True
-else:
-    if cfg.general.get('show_used_quota', 'False').lower() in ['true',]:
-        enableShowUsedQuota = True
-    else:
-        enableShowUsedQuota = False
-
-#
-# END.
-########################
-
 # Set session parameters.
 web.config.session_parameters['cookie_name'] = 'iRedAdmin'
 web.config.session_parameters['cookie_domain'] = None
         'pageSizeLimit': 50,
 
         # Show used quota.
-        'enableShowUsedQuota': enableShowUsedQuota,
+        'enableShowUsedQuota': False,
     }
 )
 

libs/ldaplib/domain.py

             except ldap.LDAPError, e:
                 msg[domain] = str(e)
 
-            # Delete records from SQL database: real-time used quota.
-            if session.get('enableShowUsedQuota', False) is True:
-                try:
-                    # SQL: DELETE FROM table WHERE username LIKE '%@domain.ltd'
-                    web.admindb.delete(
-                        models.UsedQuota.__table__,
-                        where='%s LIKE %s' % (
-                            models.UsedQuota.username,
-                            web.sqlquote('%%@'+domain),
-                        ),
-                    )
-                except Exception, e:
-                    pass
-
         if msg == {}:
             return (True,)
         else:

libs/ldaplib/user.py

             if deleteFromGroups:
                 self.deleteSingleUserFromGroups(self.mail)
 
-            # Delete record from SQL database: real-time used quota.
-            if session.get('enableShowUsedQuota', False) is True:
-                try:
-                    iredutils.deleteAccountFromUsedQuota([self.mail])
-                except:
-                    pass
-
             # Log delete action.
             web.logger(
                     msg="Delete user: %s." % (self.mail),

templates/default/ldap/user/list.html

                     {% if mailQuota == '0' %}
                         <td class="vcenter">{{ _('Unlimited') }}</td>
                     {% else %}
-                        {% if session.get('enableShowUsedQuota') is sameas true %}
-                            {% set percent = usedQuota |getPercentage(mailQuota) %}
-                            <td class="vcenter">
-                                <div>
-                                    <span>{{ percent }}%</span>
-                                    <span class="grey">(<a href="{{ctx.homepath}}/profile/user/general/{{mail}}#mailQuota" title="{{ _('Edit quota setting') }}">{{ usedQuota |filesizeformat }}/{{ mailQuota |filesizeformat }}</a>)</span>
-                                </div>
-                                {{ display_progress_bar(percent, tooltip='', show_zero=true, width='60%', style='thin') }}
-                            </td>
-                        {% else %}
-                            <td class="vcenter">{{ mailQuota |filesizeformat }}</td>
-                        {% endif %}
+                        <td class="vcenter">{{ mailQuota |filesizeformat }}</td>
                     {% endif %}
 
                     <td class="vcenter">{{ timestamp |setDatetimeFormat(hour=False) }}</td>