Skip to content

Commit 331e331

Browse files
authored
Merge pull request #7162 from fstagni/prodDNAuthor
[8.1] Production System: from DN to Author
2 parents a90acce + 0cce441 commit 331e331

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
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) DEFAULT NULL,
2930
AuthorGroup VARCHAR(255) NOT NULL,
3031
Status CHAR(32) DEFAULT 'New',
3132
PRIMARY KEY(ProductionID),

src/DIRAC/ProductionSystem/Service/ProductionManagerHandler.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ def initializeHandler(cls, serviceInfoDict):
3030
# These are the methods to manipulate the Productions table
3131
#
3232

33-
types_addProduction = [str, str]
33+
types_addProduction = [prodTypes, str]
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", credDict.get("DN", credDict.get("CN")))
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"]:
41-
gLogger.info("Added production %d" % res["Value"])
41+
gLogger.info("Added production", res["Value"])
4242
return res
4343

4444
types_deleteProduction = [prodTypes]
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

src/DIRAC/TransformationSystem/DB/TransformationDB.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ CREATE TABLE Transformations(
2929
CreationDate DATETIME,
3030
LastUpdate DATETIME,
3131
Author VARCHAR(255) NOT NULL,
32-
AuthorDN VARCHAR(255),
32+
AuthorDN VARCHAR(255) DEFAULT NULL,
3333
AuthorGroup VARCHAR(255) NOT NULL,
3434
Type CHAR(32) DEFAULT 'Simulation',
3535
Plugin CHAR(32) DEFAULT 'None',

0 commit comments

Comments
 (0)