Zhang Huangbin avatar Zhang Huangbin committed 3e2eaa4

New: Mark mail user as global admin.

Comments (0)

Files changed (25)

controllers/ldap/user.py

 
 import web
 from libs import iredutils, settings
+from libs.language import getLanguageMaps
 from libs.ldaplib import decorators, domain as domainlib, user, ldaputils, connUtils
 
 cfg = web.iredconfig
             minPasswordLength=minPasswordLength,
             maxPasswordLength=maxPasswordLength,
             domainAccountSetting=domainAccountSetting,
+            languagemaps=getLanguageMaps(),
             msg=i.get('msg', None),
         )
 

controllers/mysql/basic.py

 class Dashboard:
     @decorators.require_login
     def GET(self, checknew=False):
-        i = web.input(_unicode=False,)
-
         if checknew:
             checknew = True
 

controllers/mysql/user.py

 
 import web
 from libs import iredutils
+from libs.languages import getLanguageMaps
 from libs.mysql import decorators, user as userlib, domain as domainlib, connUtils
 
 cfg = web.iredconfig
             mail=self.mail,
             profile_type=self.profile_type,
             profile=self.profile,
+            languagemaps=getLanguageMaps(),
             msg=i.get('msg'),
         )
 

controllers/pgsql/basic.py

 class Dashboard:
     @decorators.require_login
     def GET(self, checknew=False):
-
         if checknew:
             checknew = True
 

controllers/pgsql/user.py

 
 import web
 from libs import iredutils
+from libs.languages import getLanguageMaps
 from libs.pgsql import decorators, user as userlib, domain as domainlib, connUtils
 
 cfg = web.iredconfig
             mail=self.mail,
             profile_type=self.profile_type,
             profile=self.profile,
+            languagemaps=getLanguageMaps(),
             msg=i.get('msg'),
         )
 
 
 import os
 import sys
-import ConfigParser
+from ConfigParser import SafeConfigParser
 
 import web
 from jinja2 import Environment, FileSystemLoader
 
 # init settings.ini to a web.storage
 rootdir = os.path.abspath(os.path.dirname(__file__)) + '/../'
-iniSettings = ConfigParser.SafeConfigParser()
+iniSettings = SafeConfigParser()
 cfgfile = os.path.join(rootdir, 'settings.ini')
 if os.path.exists(cfgfile):
     iniSettings.read(cfgfile)

libs/ldaplib/admin.py

     # Get preferredLanguage.
     def getPreferredLanguage(self, dn):
         dn = ldap.filter.escape_filter_chars(dn)
-        self.lang = self.conn.search_s(
+        lang = self.conn.search_s(
             dn,
             ldap.SCOPE_BASE,
             attrlist=['preferredLanguage'],
         )
-        if 'preferredLanguage' in self.lang[0][1].keys():
-            lang = self.lang[0][1]['preferredLanguage'][0]
+        if 'preferredLanguage' in lang[0][1].keys():
+            lang = lang[0][1]['preferredLanguage'][0]
         else:
             lang = web.ctx.lang
         return lang
         mod_attrs = []
         if self.profile_type == 'general':
             # Get preferredLanguage.
-            self.lang = web.safestr(data.get('preferredLanguage', 'en_US'))
-            mod_attrs += [(ldap.MOD_REPLACE, 'preferredLanguage', self.lang)]
+            lang = web.safestr(data.get('preferredLanguage', 'en_US'))
+            mod_attrs += [(ldap.MOD_REPLACE, 'preferredLanguage', lang)]
 
             # Get cn.
             cn = data.get('cn', None)
             try:
                 # Modify profiles.
                 self.conn.modify_s(self.dn, mod_attrs)
-                if session.get('username') == self.mail:
-                    session['lang'] = self.lang
+                if session.get('username') == self.mail and \
+                   session.get('lang', 'en_US') != lang:
+                    session['lang'] = lang
             except ldap.LDAPError, e:
                 return (False, ldaputils.getExceptionDesc(e))
 

libs/ldaplib/attrs.py

 
 USER_ATTRS_ALL = [
     'mail', 'cn', 'accountStatus', 'mailQuota', 'jpegPhoto',
-    'enabledService', 'memberOfGroup', 'employeeNumber',
+    'enabledService', 'memberOfGroup', 'employeeNumber', 'preferredLanguage',
     'telephoneNumber', 'userRecipientBccAddress', 'userSenderBccAddress',
     'mailForwardingAddress', 'mtaTransport',
     'storageBaseDirectory', 'mailMessageStore',  # Maildir

libs/ldaplib/user.py

 
         mod_attrs = []
         if self.profile_type == 'general':
-            # Get cn.
+            # Update domainGlobalAdmin=yes
+            if session.get('domainGlobalAdmin') is True:
+                # Update domainGlobalAdmin=yes
+                if 'domainGlobalAdmin' in data:
+                    mod_attrs = [(ldap.MOD_REPLACE, 'domainGlobalAdmin', 'yes')]
+                else:
+                    mod_attrs = [(ldap.MOD_REPLACE, 'domainGlobalAdmin', None)]
+
+            # Get display name.
             cn = data.get('cn', None)
             mod_attrs += ldaputils.getSingleModAttr(attr='cn', value=cn, default=self.mail.split('@')[0])
 
+            # Get preferred language: short lang code. e.g. en_US, de_DE.
+            preferred_lang = web.safestr(data.get('preferredLanguage', 'en_US'))
+            # Must be equal to or less than 5 characters.
+            if len(preferred_lang) > 5:
+                preferred_lang = preferred_lang[:5]
+            mod_attrs += [(ldap.MOD_REPLACE, 'preferredLanguage', preferred_lang)]
+            # Update language immediately.
+            if session.get('username') == self.mail and \
+               session.get('lang', 'en_US') != preferred_lang:
+                session['lang'] = preferred_lang
+
             # Update employeeNumber, mobile, title.
             for tmp_attr in ['employeeNumber', 'mobile', 'title', ]:
                 mod_attrs += ldaputils.getSingleModAttr(attr=tmp_attr, value=data.get(tmp_attr), default=None)

libs/models.py

-# encoding: utf-8
-# Author: Zhang Huangbin <zhb@iredmail.org>
-
-# SQL model of table: used_quota. Used in dovecot-1.2 for dictquota.
-class UsedQuota:
-    __table__ = 'used_quota'
-    username = 'username'
-    bytes = 'bytes'
-    messages = 'messages'
-
-
-# Models of MySQL backend.
-class MysqlUserPass:
-    username = 'username'
-    password = 'password'
-
-
-class MysqlPublic:
-    created = 'created'
-    modified = 'modified'
-    expired = 'expired'
-    active = 'active'
-
-
-class MysqlAdmin(MysqlUserPass, MysqlPublic):
-    __table__ = 'admin'
-    language = 'language'
-
-
-class MysqlAlias(MysqlPublic):
-    __table__ = 'alias'
-    address = 'address'
-    goto = 'goto'
-    moderators = 'moderators'
-    accesspolicy = 'accesspolicy'
-    domain = 'domain'
-
-
-class MysqlDomain(MysqlPublic):
-    __table__ = 'domain'
-    domain = 'domain'
-    description = 'description'
-    disclaimer = 'disclaimer'
-    aliases = 'aliases'
-    mailboxes = 'mailboxes'
-    maxquota = 'maxquota'
-    quota = 'quota'
-    transport = 'transport'
-    backupmx = 'backupmx'
-    defaultuserquota = 'defaultuserquota'
-    minpasswordlength = 'minpasswordlength'
-    maxpasswordlength = 'maxpasswordlength'
-
-
-class MysqlAliasDomain(MysqlPublic):
-    __table__ = 'alias_domain'
-    alias_domain = 'alias_domain'
-    target_domain = 'target_domain'
-
-
-class MysqlDomainAdmins(MysqlPublic):
-    __table__ = 'domain_admins'
-    username = 'username'
-    domain = 'domain'
-
-
-class MysqlMailbox(MysqlUserPass, MysqlPublic):
-    __table__ = 'mailbox'
-    name = 'name'
-    storagebasedirectory = 'storagebasedirectory'
-    storagenode = 'storagenode'
-    maildir = 'maildir'
-    quota = 'quota'
-    bytes = 'bytes'
-    messages = 'messages'
-    domain = 'domain'
-    transport = 'transport'
-    department = 'department'
-    rank = 'rank'
-    employeeid = 'employeeid'
-    enablesmtp = 'enablesmtp'
-    enablepop3 = 'enablepop3'
-    enablepop3secured = 'enablepop3secured'
-    enableimap = 'enableimap'
-    enableimapsecured = 'enableimapsecured'
-    enabledeliver = 'enabledeliver'
-    enablemanagesieve = 'enablemanagesieve'
-    enablemanagesievesecured = 'enablemanagesievesecured'
-    enablesieve = 'enablesieve'
-    enablesievesecured = 'enablesievesecured'
-    enableinternal = 'enableinternal'
-    lastlogindate = 'lastlogindate'
-    lastloginipv4 = 'lastloginipv4'
-    lastloginprotocol = 'lastloginprotocol'
-    disclaimer = 'disclaimer'
-    local_part = 'local_part'   # Required by PostfixAdmin
-
-
-class MysqlSenderBccDomain(MysqlPublic):
-    __table__ = 'sender_bcc_domain'
-    domain = 'domain'
-    bcc_address = 'bcc_address'
-
-
-class MysqlSenderBccUser(MysqlPublic):
-    __table__ = 'sender_bcc_user'
-    username = 'username'
-    bcc_address = 'bcc_address'
-    domain = 'domain'
-
-
-class MysqlReipientBccDomain(MysqlPublic):
-    __table__ = 'recipient_bcc_domain'
-    domain = 'domain'
-    bcc_address = 'bcc_address'
-
-
-class MysqlReipientBccUser(MysqlPublic):
-    __table__ = 'recipient_bcc_user'
-    username = 'username'
-    bcc_address = 'bcc_address'
-    domain = 'domain'
-

libs/mysql/admin.py

                         result = self.conn.select(
                             'alias',
                             what='COUNT(address) AS total',
-                            where='address <> goto',
+                            where='address <> goto AND addres<>domain',
                         )
                     else:
                         result = self.conn.select(
                             'alias',
                             vars=sql_vars,
                             what='COUNT(address) AS total',
-                            where='address <> goto AND domain IN $domains',
+                            where='address <> goto AND address<>domain AND domain IN $domains',
                         )
                 else:
                     self.sql_append_where = ''
                     if len(self.domains) == 0:
                         self.sql_append_where = 'AND alias.domain IN %s' % web.sqlquote(self.domains)
 
-                    result = self.conn.query(
-                        """
+                    result = self.conn.query("""
+                        -- Get number of mail aliases
                         SELECT COUNT(alias.address) AS total
                         FROM alias
                         LEFT JOIN domain_admins ON (alias.domain = domain_admins.domain)
-                        WHERE domain_admins.username=$admin AND alias.address <> alias.goto %s
+                        WHERE
+                            domain_admins.username=$admin
+                            AND alias.address <> alias.domain
+                            AND alias.address <> alias.goto
+                            %s
                         """ % (self.sql_append_where, ),
                         vars=sql_vars,
                     )
                 )
 
                 # Update language immediately.
-                if session.get('username') == self.mail:
+                if session.get('username') == self.mail and \
+                   session.get('lang', 'en_US') != self.preferredLanguage:
                     session['lang'] = self.preferredLanguage
             except Exception, e:
                 return (False, str(e))

libs/mysql/core.py

         if len(password) == 0:
             return (False, 'EMPTY_PASSWORD')
 
+        session['isMailUser'] = False
         # Query account from SQL database.
         if accountType == 'admin':
+            # separate admin accounts
             result = self.conn.select(
                 'admin',
                 vars={'username': username, },
                 where="username=$username AND active=1",
                 limit=1,
             )
+
+            # mail users as domain admin
+            if not result:
+                # Don't specify what= to work with old versions of iRedMail
+                result = self.conn.select(
+                    'mailbox',
+                    vars={'username': username, },
+                    where="username=$username AND active=1 AND isadmin=1",
+                    #what='username,password,language,isadmin,isglobaladmin',
+                    limit=1,
+                )
+                if result:
+                    session['isMailUser'] = True
         elif accountType == 'user':
             result = self.conn.select(
                 'mailbox',
             session['username'] = username
             session['logged'] = True
             # Set preferred language.
-            session['lang'] = str(record.language) or 'en_US'
+            session['lang'] = web.safestr(record.get('language', 'en_US'))
 
             # Set session['domainGlobalAdmin']
             try:
-                result = self.conn.select(
-                    'domain_admins',
-                    vars={'username': username, 'domain': 'ALL', },
-                    what='domain',
-                    where='username=$username AND domain=$domain',
-                    limit=1,
-                )
-                if len(result) == 1:
-                    session['domainGlobalAdmin'] = True
+                if session.get('isMailUser'):
+                    if record.get('isglobaladmin', 0) == 1:
+                        session['domainGlobalAdmin'] = True
+                else:
+                    result = self.conn.select(
+                        'domain_admins',
+                        vars={'username': username, 'domain': 'ALL', },
+                        what='domain',
+                        where='username=$username AND domain=$domain',
+                        limit=1,
+                    )
+                    if len(result) == 1:
+                        session['domainGlobalAdmin'] = True
             except:
                 pass
 

libs/mysql/user.py

                 'mailbox',
                 vars=sql_vars,
                 # Just query what we need to reduce memory use.
-                what='username,name,quota,employeeid,active,created',
+                what='username,name,quota,employeeid,active',
                 where='domain=$domain',
                 order='username ASC',
                 limit=settings.PAGE_SIZE_LIMIT,
         self.domain = self.mail.split('@', 1)[-1]
 
         # Pre-defined update key:value.
-        updates = {'modified': iredutils.getGMTTime(), }
+        updates = {'modified': iredutils.getGMTTime(), 'isadmin': 0, }
 
         if self.profile_type == 'general':
+            # Get settings of domain admin and global admin
+            managed_domain=''
+            if session.get('domainGlobalAdmin'):
+                if 'domainGlobalAdmin' in data:
+                    updates['isadmin'] = 1
+                    updates['isglobaladmin'] = 1
+                    managed_domain='ALL'
+                else:
+                    updates['isglobaladmin'] = 0
+
+            # Delete records in domain_admins first
+            self.conn.delete('domain_admins',
+                             vars={'username': self.mail},
+                             where='username=$username',
+                            )
+
+            if updates.get('isadmin') == 1:
+                try:
+                    self.conn.insert('domain_admins',
+                                     username=self.mail,
+                                     domain=managed_domain,
+                                     created=iredutils.getGMTTime(),
+                                     active=1,
+                                    )
+                except:
+                    pass
+
             # Get name
             cn = data.get('cn', '')
             updates['name'] = cn
 
+            # Get preferred language: short lang code. e.g. en_US, de_DE.
+            preferred_lang = web.safestr(data.get('preferredLanguage', 'en_US'))
+            # Must be equal to or less than 5 characters.
+            if len(preferred_lang) > 5:
+                preferred_lang = preferred_lang[:5]
+            updates['language'] = preferred_lang
+            # Update language immediately.
+            if session.get('username') == self.mail and \
+               session.get('lang', 'en_US') != preferred_lang:
+                session['lang'] = preferred_lang
+
             # Get account status
             if 'accountStatus' in data.keys():
                 updates['active'] = 1
         else:
             return (True,)
 
-        # Update SQL db with columns: maxquota, active.
+        # Update SQL db
         try:
             self.conn.update(
                 'mailbox',
                 where='username=$username AND domain=$domain',
                 **updates
             )
+
+            # Update session immediately after updating SQL.
+            if not 'domainGlobalAdmin' in data and \
+               session.get('username') == self.mail:
+                session['domainGlobalAdmin'] = False
+
             return (True,)
         except Exception, e:
             return (False, str(e))

libs/pgsql/admin.py

                         result = self.conn.select(
                             'alias',
                             what='COUNT(address) AS total',
-                            where='address <> goto',
+                            where='address <> goto AND address <> domain',
                         )
                     else:
                         result = self.conn.select(
                             'alias',
                             vars=sql_vars,
                             what='COUNT(address) AS total',
-                            where='address <> goto AND domain IN $domains',
+                            where='address <> goto AND address <> domain AND domain IN $domains',
                         )
                 else:
                     self.sql_append_where = ''
                     if len(self.domains) == 0:
                         self.sql_append_where = 'AND alias.domain IN %s' % web.sqlquote(self.domains)
 
-                    result = self.conn.query(
-                        """
+                    result = self.conn.query("""
+                        -- Get number of mail aliases
                         SELECT COUNT(alias.address) AS total
                         FROM alias
                         LEFT JOIN domain_admins ON (alias.domain = domain_admins.domain)
-                        WHERE domain_admins.username=$admin AND alias.address <> alias.goto %s
+                        WHERE
+                            domain_admins.username=$admin
+                            AND alias.addres <> alias.domain
+                            AND alias.address <> alias.goto
+                            %s
                         """ % (self.sql_append_where, ),
                         vars=sql_vars,
                     )
                 )
 
                 # Update language immediately.
-                if session.get('username') == self.mail:
+                if session.get('username') == self.mail and \
+                   session.get('lang', 'en_US') != self.preferredLanguage:
                     session['lang'] = self.preferredLanguage
             except Exception, e:
                 return (False, str(e))

libs/pgsql/core.py

         if len(password) == 0:
             return (False, 'EMPTY_PASSWORD')
 
+        session['isMailUser'] = False
         # Query account from SQL database.
         if accountType == 'admin':
+            # separate admin accounts
             result = self.conn.select(
                 'admin',
                 vars={'username': username, },
                 where="username=$username AND active=1",
                 limit=1,
             )
+
+            # mail users as domain admin
+            if not result:
+                # Don't specify what= to work with old versions of iRedMail
+                result = self.conn.select(
+                    'mailbox',
+                    vars={'username': username, },
+                    where="username=$username AND active=1 AND isadmin=1",
+                    #what='username,password,language,isadmin,isglobaladmin',
+                    limit=1,
+                )
+                if result:
+                    session['isMailUser'] = True
         elif accountType == 'user':
             result = self.conn.select(
                 'mailbox',
             session['username'] = username
             session['logged'] = True
             # Set preferred language.
-            session['lang'] = str(record.language) or 'en_US'
+            session['lang'] = web.safestr(record.get('language', 'en_US'))
 
             # Set session['domainGlobalAdmin']
             try:
-                result = self.conn.select(
-                    'domain_admins',
-                    vars={'username': username, 'domain': 'ALL', },
-                    what='domain',
-                    where='username=$username AND domain=$domain',
-                    limit=1,
-                )
-                if len(result) == 1:
-                    session['domainGlobalAdmin'] = True
+                if session.get('isMailUser'):
+                    if record.get('isglobaladmin', 0) == 1:
+                        session['domainGlobalAdmin'] = True
+                else:
+                    result = self.conn.select(
+                        'domain_admins',
+                        vars={'username': username, 'domain': 'ALL', },
+                        what='domain',
+                        where='username=$username AND domain=$domain',
+                        limit=1,
+                    )
+                    if len(result) == 1:
+                        session['domainGlobalAdmin'] = True
             except:
                 pass
 

libs/pgsql/user.py

                 'mailbox',
                 vars=sql_vars,
                 # Just query what we need to reduce memory use.
-                what='username,name,quota,employeeid,active,created',
+                what='username,name,quota,employeeid,active',
                 where='domain=$domain',
                 order='username ASC',
                 limit=settings.PAGE_SIZE_LIMIT,
         self.domain = self.mail.split('@', 1)[-1]
 
         # Pre-defined update key:value.
-        updates = {'modified': iredutils.getGMTTime(), }
+        updates = {'modified': iredutils.getGMTTime(), 'isadmin': 0, }
 
         if self.profile_type == 'general':
+            # Get settings of domain admin and global admin
+            managed_domain=''
+            if session.get('domainGlobalAdmin'):
+                if 'domainGlobalAdmin' in data:
+                    updates['isadmin'] = 1
+                    updates['isglobaladmin'] = 1
+                    managed_domain='ALL'
+                else:
+                    updates['isglobaladmin'] = 0
+
+            # Delete records in domain_admins first
+            self.conn.delete('domain_admins',
+                             vars={'username': self.mail},
+                             where='username=$username',
+                            )
+
+            if updates.get('isadmin') == 1:
+                try:
+                    self.conn.insert('domain_admins',
+                                     username=self.mail,
+                                     domain=managed_domain,
+                                     created=iredutils.getGMTTime(),
+                                     active=1,
+                                    )
+                except:
+                    pass
+
             # Get name
             cn = data.get('cn', '')
             updates['name'] = cn
 
+            # Get preferred language: short lang code. e.g. en_US, de_DE.
+            preferred_lang = web.safestr(data.get('preferredLanguage', 'en_US'))
+            # Must be equal to or less than 5 characters.
+            if len(preferred_lang) > 5:
+                preferred_lang = preferred_lang[:5]
+            updates['language'] = preferred_lang
+            # Update language immediately.
+            if session.get('username') == self.mail and \
+               session.get('lang', 'en_US') != preferred_lang:
+                session['lang'] = preferred_lang
+
             # Get account status
             if 'accountStatus' in data.keys():
                 updates['active'] = 1
         else:
             return (True,)
 
-        # Update SQL db with columns: maxquota, active.
+        # Update SQL db
         try:
             self.conn.update(
                 'mailbox',
                 where='username=$username AND domain=$domain',
                 **updates
             )
+
+            # Update session immediately after updating SQL.
+            if not 'domainGlobalAdmin' in data and \
+               session.get('username') == self.mail:
+                session['domainGlobalAdmin'] = False
+
             return (True,)
         except Exception, e:
             return (False, str(e))

templates/default/ldap/admin/profile.html

                 {{ display_csrf_token() }}
 
                 {% if profile_type == 'general' %}
-                    {% set preferredLanguage = entry.get('preferredLanguage', ['en_US'])[0] |string |e %}
-
                     <div class="columns clear">
                         <div class="col2-3">
                             {% if session.get('domainGlobalAdmin') is sameas true %}
                             {% endif %}
 
                             {{ display_input_cn(cn=cn, accountType='admin') }}
-                            {{ display_preferred_language(value=preferredLanguage, languagemaps=languagemaps) }}
+                            {{ display_preferred_language(value=entry.get('preferredLanguage', ['en_US'])[0], languagemaps=languagemaps) }}
                         </div>
                     </div>{# .columns #}
 

templates/default/ldap/user/profile.html

         display_subnav,
         display_csrf_token,
         display_input_cn,
+        display_preferred_language,
         display_quota,
         display_input_employeeid,
         display_input_jobtitle,
         display_input_mobile,
         display_input_phone,
         display_account_status,
+        display_mark_user_as_admin,
         display_reset_password,
         display_random_password,
         display_button_submit,
             <div class="col2-3">
                 {{ display_account_status(accountStatus) }}
 
+                {# Domain admin and global admin #}
+                {{ display_mark_user_as_admin(
+                        is_domain_admin='domainadmin' in enabledService,
+                        is_global_admin=entries.get('domainGlobalAdmin', ['no'])[0],
+                ) }}
+
                 <div class="bt-space10"></div>
                 {{ display_input_cn(cn) }}
+                {{ display_preferred_language(value=entries.get('preferredLanguage', ['en_US'])[0], languagemaps=languagemaps) }}
                 {{ display_quota(value=mailQuota, show_value_in_input=true) }}
 
                 <div class="bt-space10"></div>

templates/default/macros/general.html

 {%- endmacro %}
 
 
+{% macro display_mark_user_as_admin(is_domain_admin=false, is_global_admin=false) %}
+{# possible value: 0, 1 (SQL), or true, yes, false, no (LDAP) #}
+{% if session.get('domainGlobalAdmin') is sameas true %}
+<div class="form-field clear">
+    <h4 class="size-250 fl-space">{{ _('Mark this user as') }}</h4>
+    <div class="form-checkbox-item clear">
+        <span class="clean-padding bt-space20"><input class="checkbox" name="domainGlobalAdmin" value="global" type="checkbox" {% if is_global_admin in [1, true, 'yes'] %}checked{%endif%} /> {{ _('Global admin') }}</span>
+    </div>
+</div>
+{% endif %}
+{%- endmacro %}
+
+
 {# Used to display domainMaxXXXNumber #}
 {% macro display_number_of_account_limited(value, hide_unlimited=true, hide_slash=false) -%}
     {% if value == '0' or value == 0 or value == 'None' %}

templates/default/mysql/admin/profile.html

 
 {% block breadcrumb %}
     {% set crumbs = [
-            (ctx.homepath + '/admins', _('All admins'),),
-            (None, _('Profile of admin:') + '&nbsp;' + mail,),
+            (ctx.homepath + '/admins', _('All admins')),
+            (None, mail),
             ]
             %}
     {{ display_subnav(crumbs) }}
             <div id="profile_general">
                 <form name="general" method="post" action="{{ctx.homepath}}/profile/admin/general/{{mail}}">
                     {{ input_csrf_token }}
-                    {% if profile.language != '' %}
-                        {% set preferredLanguage = profile.language |string |e %}
-                    {% else %}
-                        {% set preferredLanguage = 'en_US' %}
-                    {% endif %}
 
                     <div class="columns clear">
                         <div class="col2-3">
                             {% endif %}
 
                             {{ display_input_cn(cn=profile.name, accountType='admin') }}
-                            {{ display_preferred_language(value=preferredLanguage, languagemaps=languagemaps) }}
+                            {{ display_preferred_language(value=profile.get('language', 'en_US') |e, languagemaps=languagemaps) }}
                         </div>
                     </div>{# .columns #}
 

templates/default/mysql/user/create.html

                 </ul>
 
                 <h2>
-                    {{ _('Add user under domain: %s') |format(cur_domain) }}.
+                    {{ _('Add user under domain: %s') |format(cur_domain) }}
                     <a href="{{ctx.homepath}}/profile/domain/general/{{cur_domain}}"><img src="{{ctx.homepath}}/static/{{skin}}/images/action_edit.png" title="{{ _('Edit domain profile') }}" class="vcenter"/></a>
                 </h2>
             </div>

templates/default/mysql/user/profile.html

         display_csrf_token,
         display_subnav,
         display_input_cn,
+        display_preferred_language,
         display_quota,
         display_input_employeeid,
         display_input_jobtitle,
         display_input_mobile,
         display_input_phone,
         display_account_status,
+        display_mark_us_as_admin,
         display_reset_password,
         display_random_password,
         display_button_submit,
                     <div class="columns clear">
                         <div class="col2-3">
                             {{ display_account_status(profile.active) }}
+                            {{ display_mark_user_as_admin(
+                                    is_domain_admin=profile.get('isadmin', 0),
+                                    is_global_admin=profile.get('isglobaladmin', 0),
+                            ) }}
 
                             <div class="bt-space10"></div>
                             {{ display_input_cn(profile.name) }}
+                            {{ display_preferred_language(value=profile.get('language', 'en_US'), languagemaps=languagemaps) }}
                             {{ display_quota(value=profile.quota, show_value_in_input=true) }}
 
                             <div class="bt-space10"></div>

templates/default/pgsql/admin/profile.html

 
 {% block breadcrumb %}
     {% set crumbs = [
-            (ctx.homepath + '/admins', _('All admins'),),
-            (None, _('Profile of admin:') + '&nbsp;' + mail,),
+            (ctx.homepath + '/admins', _('All admins')),
+            (None, mail),
             ]
             %}
     {{ display_subnav(crumbs) }}
             <div id="profile_general">
                 <form name="general" method="post" action="{{ctx.homepath}}/profile/admin/general/{{mail}}">
                     {{ input_csrf_token }}
-                    {% if profile.language != '' %}
-                        {% set preferredLanguage = profile.language |string |e %}
-                    {% else %}
-                        {% set preferredLanguage = 'en_US' %}
-                    {% endif %}
 
                     <div class="columns clear">
                         <div class="col2-3">
                             {% endif %}
 
                             {{ display_input_cn(cn=profile.name, accountType='admin') }}
-                            {{ display_preferred_language(value=preferredLanguage, languagemaps=languagemaps) }}
+                            {{ display_preferred_language(value=profile.get('language', 'en_US') |e, languagemaps=languagemaps) }}
                         </div>
                     </div>{# .columns #}
 

templates/default/pgsql/user/create.html

                 </ul>
 
                 <h2>
-                    {{ _('Add user under domain: %s') |format(cur_domain) }}.
+                    {{ _('Add user under domain: %s') |format(cur_domain) }}
                     <a href="{{ctx.homepath}}/profile/domain/general/{{cur_domain}}"><img src="{{ctx.homepath}}/static/{{skin}}/images/action_edit.png" title="{{ _('Edit domain profile') }}" class="vcenter"/></a>
                 </h2>
             </div>

templates/default/pgsql/user/profile.html

         display_csrf_token,
         display_subnav,
         display_input_cn,
+        display_preferred_language,
         display_quota,
         display_input_employeeid,
         display_input_jobtitle,
         display_input_mobile,
         display_input_phone,
         display_account_status,
+        display_mark_us_as_admin,
         display_reset_password,
         display_random_password,
         display_button_submit,
                     <div class="columns clear">
                         <div class="col2-3">
                             {{ display_account_status(profile.active) }}
+                            {{ display_mark_user_as_admin(
+                                    is_domain_admin=profile.get('isadmin', 0),
+                                    is_global_admin=profile.get('isglobaladmin', 0),
+                            ) }}
 
                             <div class="bt-space10"></div>
                             {{ display_input_cn(profile.name) }}
+                            {{ display_preferred_language(value=profile.get('language', 'en_US'), languagemaps=languagemaps) }}
                             {{ display_quota(value=profile.quota, show_value_in_input=true) }}
 
                             <div class="bt-space10"></div>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.