Esempio n. 1
0
 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)))
Esempio n. 2
0
 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)))
Esempio n. 3
0
 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'))
Esempio n. 4
0
 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)))
Esempio n. 5
0
 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')))
Esempio n. 6
0
 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()))
Esempio n. 7
0
 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()))
Esempio n. 8
0
 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')))
Esempio n. 9
0
 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')
Esempio n. 10
0
 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
Esempio n. 11
0
 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')
Esempio n. 12
0
 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')
Esempio n. 13
0
 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')
Esempio n. 14
0
 def reports(self):
     user = self.get_auth()
     return render('base.html',
                   user=user,
                   breadcrumbs=WebCode.breadcrumbs('reports'),
                   body=render('reports.html'))
Esempio n. 15
0
 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)))
Esempio n. 16
0
 def about(self):
     user = self.get_auth()
     return render('base.html',
                   user=user,
                   breadcrumbs=WebCode.breadcrumbs('settings'),
                   body=render('about.html'))