Commit fa53259b authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Renamed 'rap_id' with 'user_id'.

parent 1c4a0399
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ class DataAMQPServer(AMQPServer):
            job.setType("other")
            job.setInfo(requestBody)
            job.setPhase("PENDING")
            job.setOwnerId(self.dbConn.getRapId(username))
            job.setOwnerId(self.dbConn.getUserId(username))
            self.dbConn.insertJob(job)
            dbResponse = self.dbConn.getJob(job.jobId)
            job.jobInfo["storageId"] = requestBody["storageId"]
+8 −8
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ class DbConnector(object):
                    JOIN node n ON p.node_id = n.node_id
                    JOIN location l ON n.location_id = l.location_id
                    JOIN storage s ON s.storage_id = l.storage_src_id
                    JOIN users u ON u.rap_id = n.owner_id
                    JOIN users u ON u.user_id = n.owner_id
                    WHERE p.vos_path = %s;
                    """,
                    (vospacePath,))
@@ -326,24 +326,24 @@ class DbConnector(object):
        else:
            return False

    def getRapId(self, username):
        """Returns the RAP id for a given user name."""
    def getUserId(self, username):
        """Returns the user id for a given user name."""
        with self.getConnection() as conn:
            try:
                cursor = conn.cursor(cursor_factory = RealDictCursor)
                cursor.execute("SELECT rap_id FROM users WHERE user_name = %s;", (username,))
                cursor.execute("SELECT user_id FROM users WHERE user_name = %s;", (username,))
                result = cursor.fetchall()
            except Exception as e:
                if not conn.closed:
                    conn.rollback()
        return result[0]["rap_id"]
        return result[0]["user_id"]

    def getUserName(self, rapId):
        """Returns the user name for a given RAP id."""
    def getUserName(self, userId):
        """Returns the user name for a given user id."""
        with self.getConnection() as conn:
            try:
                cursor = conn.cursor(cursor_factory = RealDictCursor)
                cursor.execute("SELECT user_name FROM users WHERE rap_id = %s;", (rapId,))
                cursor.execute("SELECT user_name FROM users WHERE user_id = %s;", (userId,))
                result = cursor.fetchall()
            except Exception as e:
                if not conn.closed:
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ class ImportAMQPServer(AMQPServer):
                             "errorMsg": "The user does not exist or is not registered in the database." }
                return response
            
            userId = self.dbConn.getRapId(username)
            userId = self.dbConn.getUserId(username)
            pathPrefix = self.dbConn.storageBasePathIsValid(path)
            
            if pathPrefix:
+1 −1
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ class StorePreprocessor(TaskExecutor):

        # File catalog update
        out = open("store_preprocessor_log.txt", "a")
        self.userId = self.dbConn.getRapId(self.username)
        self.userId = self.dbConn.getUserId(self.username)
        out.write(f"USER: {self.username}\n")
        out.write(f"USER_ID: {self.userId}\n")
        pathPrefix = self.storageStorePath.replace("{username}", self.username)