Beispiel #1
0
 def change_S_name(self, old_name, new_name):
     if old_name in self.servers:
         if new_name in self.servers:
             raise Auth.UsernameAlreadyExists(new_name)
         else:
             serverobject = self.servers[old_name]
             serverobject._changeName(new_name)
             self.servers[new_name] = serverobject
             del self.servers[old_name]
             self._save_S_to_database()
     else:
         raise Auth.UsernameDoesNotExists(old_name)
Beispiel #2
0
 def change_S_password(self, name, password):
     if password is not None:
         if name in self.servers:
             serverobject = self.servers[name]
             serverobject._changePassword(password)
         else:
             raise Auth.UsernameDoesNotExists(name)
         self._save_S_to_database()
Beispiel #3
0
 def add_server(self, name, ip, port, password=None):
     if name in self.servers:
         raise Auth.UsernameAlreadyExists(name)
     if password is not None:
         serverobject = Server(name, ip, port, password)
     else:
         serverobject = Server(name, ip, port)
     self.servers[name] = serverobject
     self._save_S_to_database()
Beispiel #4
0
 def change_S_connect(self, name, i=None, p=None):
     if name in self.servers:
         serverobject = self.servers[name]
         if (i is not None) and (p is not None):
             serverobject._changeIp(i)
             serverobject._changePort(p)
         elif (i is not None) and (p is None):
             serverobject._changeIp(i)
         elif (i is None) and (p is not None):
             serverobject._changePort(p)
     else:
         raise Auth.UsernameDoesNotExists(name)
     self._save_S_to_database()
Beispiel #5
0
 def signOut(self, username):
     if self.cas.is_logged_in(username):
         self.cas.users[username].is_logged_in = False
     else:
         raise Auth.InvalidUsername(username)
Beispiel #6
0
    def signIn(self, username, password):
        if self.cas.is_logged_in(username):
            raise Auth.UserAlreadySignedIn(username)

        verify = self.cas.login(username, password)
        return verify
Beispiel #7
0
 def _CAS_init(self, path1, path2):
     cas = Auth.Authenticator(path1, path2)
     return cas