mirror of https://gitlab.com/bashrc2/epicyon
More checks that admin user is defined
parent
fb1d561bae
commit
22f31f0356
|
@ -789,6 +789,8 @@ def suspendAccount(baseDir: str, nickname: str, domain: str) -> None:
|
|||
"""
|
||||
# Don't suspend the admin
|
||||
adminNickname = getConfigParam(baseDir, 'admin')
|
||||
if not adminNickname:
|
||||
return
|
||||
if nickname == adminNickname:
|
||||
return
|
||||
|
||||
|
@ -843,6 +845,8 @@ def canRemovePost(baseDir: str, nickname: str,
|
|||
|
||||
# is the post by the admin?
|
||||
adminNickname = getConfigParam(baseDir, 'admin')
|
||||
if not adminNickname:
|
||||
return False
|
||||
if domainFull + '/users/' + adminNickname + '/' in postId:
|
||||
return False
|
||||
|
||||
|
@ -899,6 +903,8 @@ def removeAccount(baseDir: str, nickname: str,
|
|||
"""
|
||||
# Don't remove the admin
|
||||
adminNickname = getConfigParam(baseDir, 'admin')
|
||||
if not adminNickname:
|
||||
return False
|
||||
if nickname == adminNickname:
|
||||
return False
|
||||
|
||||
|
|
10
posts.py
10
posts.py
|
@ -74,14 +74,20 @@ def isModerator(baseDir: str, nickname: str) -> bool:
|
|||
moderatorsFile = baseDir + '/accounts/moderators.txt'
|
||||
|
||||
if not os.path.isfile(moderatorsFile):
|
||||
if getConfigParam(baseDir, 'admin') == nickname:
|
||||
adminName = getConfigParam(baseDir, 'admin')
|
||||
if not adminName:
|
||||
return False
|
||||
if adminName == nickname:
|
||||
return True
|
||||
return False
|
||||
|
||||
with open(moderatorsFile, "r") as f:
|
||||
lines = f.readlines()
|
||||
if len(lines) == 0:
|
||||
if getConfigParam(baseDir, 'admin') == nickname:
|
||||
adminName = getConfigParam(baseDir, 'admin')
|
||||
if not adminName:
|
||||
return False
|
||||
if adminName == nickname:
|
||||
return True
|
||||
for moderator in lines:
|
||||
moderator = moderator.strip('\n').strip('\r')
|
||||
|
|
Loading…
Reference in New Issue