def GET(self): i = web.input() return web.render('ldap/admin/create.html', languagemaps=languages.getLanguageMaps(), default_language=cfg.general.get('lang', 'en_US'), min_passwd_length=cfg.general.get('min_passwd_length'), max_passwd_length=cfg.general.get('max_passwd_length'), msg=i.get('msg'), )
def GET(self, profile_type, mail): i = web.input() self.mail = web.safestr(mail) self.profile_type = web.safestr(profile_type) if not iredutils.isEmail(self.mail): raise web.seeother('/admins?msg=INVALID_MAIL') if session.get('domainGlobalAdmin' ) is not True and session.get('username') != self.mail: # Don't allow to view/update other admins' profile. raise web.seeother( '/profile/admin/general/%s?msg=PERMISSION_DENIED' % session.get('username')) adminLib = adminlib.Admin() result = adminLib.profile(mail=self.mail) if result[0] is True: domainGlobalAdmin, profile = result[1], result[2] # Get all domains. self.allDomains = [] domainLib = domainlib.Domain() resultOfAllDomains = domainLib.getAllDomains() if resultOfAllDomains[0] is True: self.allDomains = resultOfAllDomains[1] # Get managed domains. self.managedDomains = [] connutils = connUtils.Utils() qr = connutils.getManagedDomains( admin=self.mail, domainNameOnly=True, listedOnly=True, ) if qr[0] is True: self.managedDomains += qr[1] return web.render( 'dbmail_mysql/admin/profile.html', mail=self.mail, profile_type=self.profile_type, domainGlobalAdmin=domainGlobalAdmin, profile=profile, languagemaps=languages.getLanguageMaps(), allDomains=self.allDomains, managedDomains=self.managedDomains, min_passwd_length=cfg.general.get('min_passwd_length', '0'), max_passwd_length=cfg.general.get('max_passwd_length', '0'), msg=i.get('msg'), ) else: raise web.seeother('/admins?msg=' + web.urlquote(result[1]))
def GET(self): i = web.input() return web.render( "mysql/admin/create.html", languagemaps=languages.getLanguageMaps(), default_language=cfg.general.get("lang", "en_US"), min_passwd_length=cfg.general.get("min_passwd_length"), max_passwd_length=cfg.general.get("max_passwd_length"), msg=i.get("msg"), )
def GET(self): if session.get('logged') is True: return web.seeother('/dashboard') else: i = web.input(_unicode=False) # Show login page. return web.render( 'login.html', languagemaps=languages.getLanguageMaps(), msg=i.get('msg'), )
def GET(self, profile_type, mail): i = web.input() self.mail = web.safestr(mail) self.profile_type = web.safestr(profile_type) if not iredutils.isEmail(self.mail): return web.seeother("/admins?msg=INVALID_MAIL") if session.get("domainGlobalAdmin") is not True and session.get("username") != self.mail: # Don't allow to view/update other admins' profile. return web.seeother("/profile/admin/general/%s?msg=PERMISSION_DENIED" % session.get("username")) adminLib = adminlib.Admin() result = adminLib.profile(mail=self.mail) if result[0] is True: domainGlobalAdmin, profile = result[1], result[2] # Get all domains. self.allDomains = [] domainLib = domainlib.Domain() resultOfAllDomains = domainLib.getAllDomains() if resultOfAllDomains[0] is True: self.allDomains = resultOfAllDomains[1] # Get managed domains. self.managedDomains = [] qr = adminLib.getManagedDomains(admin=self.mail, domainNameOnly=True, listedOnly=True) if qr[0] is True: self.managedDomains += qr[1] return web.render( "mysql/admin/profile.html", mail=self.mail, profile_type=self.profile_type, domainGlobalAdmin=domainGlobalAdmin, profile=profile, languagemaps=languages.getLanguageMaps(), allDomains=self.allDomains, managedDomains=self.managedDomains, min_passwd_length=cfg.general.get("min_passwd_length", "0"), max_passwd_length=cfg.general.get("max_passwd_length", "0"), msg=i.get("msg"), ) else: return web.seeother("/admins?msg=" + result[1])
def GET(self, profile_type, mail): self.mail = web.safestr(mail) self.profile_type = web.safestr(profile_type) if session.get('domainGlobalAdmin') is not True and session.get('username') != self.mail: # Don't allow to view/update other admins' profile. return web.seeother('/profile/admin/general/%s?msg=PERMISSION_DENIED' % session.get('username')) adminLib = admin.Admin() # Get admin profile. result = adminLib.profile(self.mail) if result[0] is not True: return web.seeother('/admins?msg=' + result[1]) else: self.admin_profile = result[1] i = web.input() if self.profile_type == 'general': # Get available languages. if result[0] is True: ################### # Managed domains # # Check permission. #if session.get('domainGlobalAdmin') is not True: # return web.seeother('/profile/admin/general/%s?msg=PERMISSION_DENIED' % self.mail) # Get all domains. domainLib = domainlib.Domain() resultOfAllDomains = domainLib.listAccounts(attrs=['domainName', 'cn', ]) if resultOfAllDomains[0] is True: self.allDomains = resultOfAllDomains[1] else: return resultOfAllDomains # Get domains under control. resultOfManagedDomains = adminLib.getManagedDomains(mail=self.mail, attrs=['domainName', ]) if resultOfManagedDomains[0] is True: self.managedDomains = [] for d in resultOfManagedDomains[1]: if 'domainName' in d[1].keys(): self.managedDomains += d[1].get('domainName') else: return resultOfManagedDomains return web.render( 'ldap/admin/profile.html', mail=self.mail, profile_type=self.profile_type, profile=self.admin_profile, languagemaps=languages.getLanguageMaps(), allDomains=self.allDomains, managedDomains=self.managedDomains, msg=i.get('msg', None), ) else: return web.seeother('/profile/admin/%s/%s?msg=%s' % (self.profile_type, self.mail, result[1])) elif self.profile_type == 'password': return web.render('ldap/admin/profile.html', mail=self.mail, profile_type=self.profile_type, profile=self.admin_profile, min_passwd_length=cfg.general.get('min_passwd_length'), max_passwd_length=cfg.general.get('max_passwd_length'), msg=i.get('msg', None), )