mirror of https://gitlab.com/bashrc2/epicyon
Comments
parent
0b19087c88
commit
ba0ec266d7
17
person.py
17
person.py
|
@ -580,6 +580,8 @@ def personUpgradeActor(baseDir: str, personJson: {},
|
||||||
occupationName = personJson['occupation']
|
occupationName = personJson['occupation']
|
||||||
del personJson['occupation']
|
del personJson['occupation']
|
||||||
|
|
||||||
|
# if the older skills format is being used then switch
|
||||||
|
# to the new one
|
||||||
if not personJson.get('hasOccupation'):
|
if not personJson.get('hasOccupation'):
|
||||||
personJson['hasOccupation'] = {
|
personJson['hasOccupation'] = {
|
||||||
'@type': 'Occupation',
|
'@type': 'Occupation',
|
||||||
|
@ -588,15 +590,18 @@ def personUpgradeActor(baseDir: str, personJson: {},
|
||||||
}
|
}
|
||||||
updateActor = True
|
updateActor = True
|
||||||
|
|
||||||
|
# remove the old skills format
|
||||||
if personJson.get('skills'):
|
if personJson.get('skills'):
|
||||||
del personJson['skills']
|
del personJson['skills']
|
||||||
updateActor = True
|
updateActor = True
|
||||||
|
|
||||||
|
# if the older roles format is being used then switch
|
||||||
|
# to the new one
|
||||||
if not personJson.get('affiliation'):
|
if not personJson.get('affiliation'):
|
||||||
rolesStr = ''
|
rolesStr = ''
|
||||||
adminName = getConfigParam(baseDir, 'admin')
|
adminName = getConfigParam(baseDir, 'admin')
|
||||||
if personJson['id'].endswith('/users/' + adminName):
|
if personJson['id'].endswith('/users/' + adminName):
|
||||||
rolesStr = 'admin'
|
rolesStr = 'admin, moderator, editor'
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
personJson['affiliation'] = {
|
personJson['affiliation'] = {
|
||||||
"@type": "OrganizationRole",
|
"@type": "OrganizationRole",
|
||||||
|
@ -609,6 +614,16 @@ def personUpgradeActor(baseDir: str, personJson: {},
|
||||||
}
|
}
|
||||||
updateActor = True
|
updateActor = True
|
||||||
|
|
||||||
|
# if no roles are defined then ensure that the admin
|
||||||
|
# roles are configured
|
||||||
|
if not personJson['affiliation']['roleName']:
|
||||||
|
adminName = getConfigParam(baseDir, 'admin')
|
||||||
|
if personJson['id'].endswith('/users/' + adminName):
|
||||||
|
personJson['affiliation']['roleName'] = \
|
||||||
|
'admin, moderator, editor'
|
||||||
|
updateActor = True
|
||||||
|
|
||||||
|
# remove the old roles format
|
||||||
if personJson.get('roles'):
|
if personJson.get('roles'):
|
||||||
del personJson['roles']
|
del personJson['roles']
|
||||||
updateActor = True
|
updateActor = True
|
||||||
|
|
Loading…
Reference in New Issue