Exemple #1
0
 def _set_user(self):
     """
     Create the user object based on the user input
     """
     username = self.txtUserName.text()
     password = self.txtPassword.text()
     self.User = User(username, password)
Exemple #2
0
    def getUser(self, username):
        """
        Gets the user object based on the username.
        Returns 'None' if not found
        """
        user = None

        t = text("select valuntil from pg_user where usename = :uname")
        conn = self._engine.connect()
        result = conn.execute(t, uname=username).fetchone()

        if result is not None:
            user = User(username)

            # Get the date component only - first ten characters
            valDate = result["valuntil"]
            if valDate is not None:
                valDate = valDate.strftime("%Y%m%d")

            user.Validity = valDate

        return user
Exemple #3
0
    def _setUser(self):
        """
        Create/update the user object based on the user input
        rtype: str
        """
        username = self.txtUserName.text()
        password = self.txtPass.text()

        if self.user == None:
            self.user = User(username, password)
            user_info = 'NEW'
        else:
            self.user.Password = password
            user_info = 'EDIT'

        self.user.Validity = self.set_password_validity()

        return user_info
Exemple #4
0
    def _setUser(self):
        '''
        Create/update the user object based on the user input
        '''
        username = self.txtUserName.text()
        password = self.txtPass.text()

        if self.user == None:
            self.user = User(username,password)

        else:
            self.user.Password = password

        #Set validity if specified
        if self.chkValidity.checkState() == Qt.Unchecked:
            self.user.Validity = self.dtValidity.date().toPyDate()
        else:
            #Set password to never expire
            self.user.Validity = 'infinity'
Exemple #5
0
def create_db_connection():
    db_conn = DatabaseConnection(DB_SERVER, DB_PORT, DB_NAME)
    user = User(DB_USER, DB_PASS)
    db_conn.User = user

    return db_conn