Skip to content

Commit 91e4d22

Browse files
authored
Merge pull request #7092 from simon-mazenoux/feat-refactoring-jobPolicy-for-diracx
[8.0] Changing access specifiers of JobPolicy from private to protected
2 parents 08aa4ee + 6bd60c1 commit 91e4d22

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/DIRAC/WorkloadManagementSystem/Service/JobPolicy.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ def __init__(self, userDN, userGroup, allInfo=True):
8383
self.userProperties = getPropertiesForGroup(userGroup, [])
8484
self.jobDB = None
8585
self.allInfo = allInfo
86-
self.__permissions = {}
87-
self.__getUserJobPolicy()
86+
self._permissions = {}
87+
self._getUserJobPolicy()
8888

8989
def getUserRightsForJob(self, jobID, owner=None, group=None):
9090
"""Get access rights to job with jobID for the user specified by
@@ -102,44 +102,44 @@ def getUserRightsForJob(self, jobID, owner=None, group=None):
102102

103103
return self.getJobPolicy(owner, group)
104104

105-
def __getUserJobPolicy(self):
105+
def _getUserJobPolicy(self):
106106
"""Get the job rights for the primary user for which the JobPolicy object
107107
is created
108108
"""
109109
# Can not do anything by default
110110
for right in ALL_RIGHTS:
111-
self.__permissions[right] = False
111+
self._permissions[right] = False
112112

113113
# Anybody can get info about the jobs
114114
if self.allInfo:
115-
self.__permissions[RIGHT_GET_INFO] = True
115+
self._permissions[RIGHT_GET_INFO] = True
116116

117117
# Give JobAdmin permission if needed
118118
if Properties.JOB_ADMINISTRATOR in self.userProperties:
119119
for right in PROPERTY_RIGHTS[Properties.JOB_ADMINISTRATOR]:
120-
self.__permissions[right] = True
120+
self._permissions[right] = True
121121

122122
# Give JobMonitor permission if needed
123123
if Properties.JOB_MONITOR in self.userProperties:
124124
for right in PROPERTY_RIGHTS[Properties.JOB_MONITOR]:
125-
self.__permissions[right] = True
125+
self._permissions[right] = True
126126

127127
# Give normal user permission if needed
128128
if Properties.NORMAL_USER in self.userProperties:
129129
for right in PROPERTY_RIGHTS[Properties.NORMAL_USER]:
130-
self.__permissions[right] = True
130+
self._permissions[right] = True
131131

132132
# Give permissions of the generic pilot
133133
if Properties.GENERIC_PILOT in self.userProperties:
134134
for right in PROPERTY_RIGHTS[Properties.GENERIC_PILOT]:
135-
self.__permissions[right] = True
135+
self._permissions[right] = True
136136

137137
def getJobPolicy(self, jobOwner="", jobOwnerGroup=""):
138138
"""Get the job operations rights for a job owned by jobOwnerDN/jobOwnerGroup
139139
for a user with userDN/userGroup.
140140
Returns a dictionary of various operations rights
141141
"""
142-
permDict = dict(self.__permissions)
142+
permDict = dict(self._permissions)
143143
# Job Owner can do everything with his jobs
144144
if jobOwner and self.userName and jobOwner == self.userName:
145145
for right in OWNER_RIGHTS:

0 commit comments

Comments
 (0)