예제 #1
0
 def test_save_user(self):
     new_name = "Testy"
     test_user = cT.user_by_id(self.user)
     test_user.firstName = new_name
     cT.save_user(test_user)
     mod_user = cT.user_by_id(self.user)
     self.assertEqual(mod_user.firstName, new_name)
 def log_visit(self):
     user = self.controller.user
     date_stamp = datetime.datetime.now()
     date_stamp = date_stamp.strftime("%d-%b-%Y (%H:%M:%S.%f)")
     self.curr_user.add_to_log(date_stamp, (user.firstName + user.lastName))
     cT.save_user(self.curr_user)
     subject = "Notification of VM Access"
     message = "{},\n The following is to notify you that {} {} accessed your VM on {}. " \
               "If something has changed in" \
               "your configuration notify " \
               "an instructor at your earliest continence.".format(self.curr_user.firstName, user.firstName,
                                                                   user.lastName, date_stamp)
     cT.notify_user(self.curr_user, subject, message)
예제 #3
0
 def toggle_suspend(self):
     if self.suspended is False:
         self.suspended = True
         self.suspend_button.config(text="Enable")
         self.suspend_button.update()
         self.selected_user.isSuspended = False
         cT.save_user(self.selected_user)
     else:
         self.suspended = False
         self.suspend_button.config(text="Suspend")
         self.suspend_button.update()
         self.selected_user.isSuspended = True
         cT.save_user(self.selected_user)
예제 #4
0
 def update_user(self):
     curr_user = self.selected_user
     curr_user.studentID = self.id_entry.get()
     curr_user.set_custom_user_name(curr_user.studentID)
     curr_user.firstName = self.fn_entry.get()
     curr_user.lastName = self.ln_entry.get()
     curr_user.eMail = self.email_entry.get()
     if self.pass_entry.get():
         curr_user.set_custom_password(self.pass_entry.get())
     cT.save_user(curr_user)
     self.update_list()
     messagebox.showinfo("Update",
                         "The user information has been updated.",
                         parent=self)