Skip to content

Commit aa0d1c3

Browse files
committed
feat: from DN to Author
1 parent 9484c77 commit aa0d1c3

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/DIRAC/ProductionSystem/DB/ProductionDB.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, dbname=None, dbconfig=None, dbIn=None, parentLogger=None):
4444
"Description",
4545
"CreationDate",
4646
"LastUpdate",
47-
"AuthorDN",
47+
"Author",
4848
"AuthorGroup",
4949
"Status",
5050
]
@@ -77,12 +77,12 @@ def __init__(self, dbname=None, dbconfig=None, dbIn=None, parentLogger=None):
7777
"Cleaned": "cleanTransformation",
7878
}
7979

80-
def addProduction(self, prodName, prodDescription, authorDN, authorGroup, connection=False):
80+
def addProduction(self, prodName, prodDescription, author, authorGroup, connection=False):
8181
"""Create new production starting from its description
8282
8383
:param str prodName: a string with the Production name
8484
:param str prodDescription: a json object with the Production description
85-
:param str authorDN: string with the author DN
85+
:param str author: string with the author
8686
:param str authorGroup: string with author group
8787
"""
8888
connection = self.__getConnection(connection)
@@ -96,9 +96,9 @@ def addProduction(self, prodName, prodDescription, authorDN, authorGroup, connec
9696

9797
req = (
9898
"INSERT INTO Productions (ProductionName,Description,CreationDate,LastUpdate,\
99-
AuthorDN,AuthorGroup,Status)\
99+
Author,AuthorGroup,Status)\
100100
VALUES ('%s','%s',UTC_TIMESTAMP(),UTC_TIMESTAMP(),'%s','%s','New');"
101-
% (prodName, prodDescription, authorDN, authorGroup)
101+
% (prodName, prodDescription, author, authorGroup)
102102
)
103103

104104
res = self._update(req, conn=connection)

src/DIRAC/ProductionSystem/DB/ProductionDB.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ CREATE TABLE Productions(
2525
Description LONGTEXT,
2626
CreationDate DATETIME,
2727
LastUpdate DATETIME,
28-
AuthorDN VARCHAR(255) NOT NULL,
28+
Author VARCHAR(255) NOT NULL,
29+
AuthorDN VARCHAR(255),
2930
AuthorGroup VARCHAR(255) NOT NULL,
3031
Status CHAR(32) DEFAULT 'New',
3132
PRIMARY KEY(ProductionID),

src/DIRAC/ProductionSystem/Service/ProductionManagerHandler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def initializeHandler(cls, serviceInfoDict):
3434

3535
def export_addProduction(self, prodName, prodDescription):
3636
credDict = self.getRemoteCredentials()
37-
authorDN = credDict.get("DN", credDict.get("CN"))
37+
author = credDict.get("username")
3838
authorGroup = credDict.get("group")
39-
res = self.productionDB.addProduction(prodName, prodDescription, authorDN, authorGroup)
39+
res = self.productionDB.addProduction(prodName, prodDescription, author, authorGroup)
4040
if res["OK"]:
4141
gLogger.info("Added production %d" % res["Value"])
4242
return res
@@ -45,8 +45,8 @@ def export_addProduction(self, prodName, prodDescription):
4545

4646
def export_deleteProduction(self, prodName):
4747
credDict = self.getRemoteCredentials()
48-
authorDN = credDict.get("DN", credDict.get("CN"))
49-
return self.productionDB.deleteProduction(prodName, author=authorDN)
48+
author = credDict.get("username")
49+
return self.productionDB.deleteProduction(prodName, author=author)
5050

5151
types_getProductions = []
5252

0 commit comments

Comments
 (0)