def events(self, status=1): user = self.get_auth() return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('events'), body=render('refresh.html', url='/events_content/' + str(status)))
def index(self, page=1): user = self.get_auth() return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('home'), body=render('refresh.html', url='/index_content/' + str(page)))
def error(self): user = self.get_auth() return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('settings'), body=render('basic.html', title='Error', content='Error'))
def search(self, device=None): user = self.get_auth() return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('settings'), body=render('basic.html', title='Search Results', content=WebCode.search_devices(device)))
def help(self): user = self.get_auth() return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('settings'), body=render('basic.html', title='Help', content=render('help.html')))
def users(self): user = self.get_auth() return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('settings'), body=render('basic.html', title='Users', content=WebCode.user_list()))
def notify(self): user = self.get_auth() return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('settings'), body=render('basic.html', title='Notification Rules', content=WebCode.notify_rules()))
def user_add(self, username=None, password=None, role=None): user = self.get_auth() if not username is None and not password is None and not role is None: WebCode.user_add(username, password, role) self.redirect('/users') else: return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('settings'), body=render('basic.html', title='Users', content=render('user_add.html')))
def password(self, pass1=None, pass2=None): user = self.get_auth() if pass1 is None and pass2 is None: return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('settings'), body=render('basic.html', title='Change Password', content=render('password_change.html'))) else: changepw = WebAuth.change_password(user, pass1, pass2) if changepw is True: self.redirect('/settings') else: self.redirect('/error')
def devices(self, name=None, monitor=None): user = self.get_auth() if name is None and monitor is None: html = render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('devices'), body=render('basic.html', title='Devices', content=WebCode.device_index())) elif not name is None and monitor is None: html = render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('device', name), body=render('refresh.html', url='/device_content/' + name)) elif not name is None and not monitor is None: html = render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs( 'device_graph', name, monitor), body=render('refresh.html', url='/device_graph_content/' + name + '/' + monitor)) return html
def user_edit_role(self, id, role=None): user = self.get_auth() if role == None: WD = Data() roleid = WD.select_user(id) return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('settings'), body=render('basic.html', title='Users', content=WebCode.load_user_edit_role( roleid['role']))) else: WD = Data() WD.edit_user_role(id, role) self.redirect('/users')
def user_edit_pass(self, id, pass1=None, pass2=None): user = self.get_auth() if pass1 is None and pass2 is None: return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('settings'), body=render( 'basic.html', title='Users', content=render('user_edit_password.html'))) else: encryptpw = WebAuth.set_password(pass1, pass2) if not encryptpw is None: WD.edit_user_password(str(id), encryptpw) self.redirect('/users') else: self.redirect('/error')
def notify_add(self, notify_name=None, notify_email=None, agent_name=None, agent_monitor=None, agent_status=None, agent_severity=None, notify_enabled=None): user = self.get_auth() html = '' if notify_name is None and notify_email is None and agent_name is None and agent_monitor is None and agent_status is None and agent_severity is None and notify_enabled is None: return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('settings'), body=render('basic.html', title='Add Notification Rule', content=WebCode.notify_add())) else: WD.insert_notifyrules(notify_name, notify_email, agent_name, agent_monitor, agent_status, agent_severity, notify_enabled) self.redirect('/notify')
def reports(self): user = self.get_auth() return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('reports'), body=render('reports.html'))
def user_delete(self, id): user = self.get_auth() return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('settings'), body=render('user_delete.html', id=str(id)))
def about(self): user = self.get_auth() return render('base.html', user=user, breadcrumbs=WebCode.breadcrumbs('settings'), body=render('about.html'))