Check that the editor is the admin

merge-requests/30/head
Bob Mottram 2020-11-10 12:28:54 +00:00
parent d78139a258
commit 67ea679887
1 changed files with 21 additions and 18 deletions

View File

@ -2908,25 +2908,28 @@ class PubServer(BaseHTTPRequestHandler):
if os.path.isfile(linksFilename): if os.path.isfile(linksFilename):
os.remove(linksFilename) os.remove(linksFilename)
if fields.get('editedAbout'): adminNickname = \
aboutStr = fields['editedAbout'] getConfigParam(baseDir, 'admin')
aboutFile = open(aboutFilename, "w+") if nickname == adminNickname:
if aboutFile: if fields.get('editedAbout'):
aboutFile.write(aboutStr) aboutStr = fields['editedAbout']
aboutFile.close() aboutFile = open(aboutFilename, "w+")
else: if aboutFile:
if os.path.isfile(aboutFilename): aboutFile.write(aboutStr)
os.remove(aboutFilename) aboutFile.close()
else:
if os.path.isfile(aboutFilename):
os.remove(aboutFilename)
if fields.get('editedTOS'): if fields.get('editedTOS'):
TOSStr = fields['editedTOS'] TOSStr = fields['editedTOS']
TOSFile = open(TOSFilename, "w+") TOSFile = open(TOSFilename, "w+")
if TOSFile: if TOSFile:
TOSFile.write(TOSStr) TOSFile.write(TOSStr)
TOSFile.close() TOSFile.close()
else: else:
if os.path.isfile(TOSFilename): if os.path.isfile(TOSFilename):
os.remove(TOSFilename) os.remove(TOSFilename)
# redirect back to the default timeline # redirect back to the default timeline
if callingDomain.endswith('.onion') and \ if callingDomain.endswith('.onion') and \