mirror of
https://github.com/FAUSheppy/open-web-leaderboard.git
synced 2025-12-06 07:01:36 +01:00
implement player blacklisting for gdpr
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,3 +16,4 @@ static/moment.js
|
||||
*.exe
|
||||
*.sqlite
|
||||
*.png
|
||||
blacklist.json
|
||||
|
||||
@@ -25,6 +25,13 @@ or with a runner like *waitress*:
|
||||
|
||||
the *DB_PATH* is set in *config.py* in this case.
|
||||
|
||||
# GDPR: Blacklisting players
|
||||
Players can be blacklisted by name via a *blacklist.json* file in the project root.
|
||||
|
||||
{
|
||||
"blacklist" : ["name", "name_2"]
|
||||
}
|
||||
|
||||
# Preview
|
||||

|
||||
|
||||
|
||||
17
Round.py
17
Round.py
@@ -1,6 +1,8 @@
|
||||
import json
|
||||
import datetime
|
||||
import player
|
||||
import json
|
||||
import os
|
||||
|
||||
class Round:
|
||||
def __init__(self, dbRow):
|
||||
@@ -18,6 +20,21 @@ class Round:
|
||||
self.winnerSide = winnerSide
|
||||
self.duration = datetime.timedelta(seconds=int(duration))
|
||||
|
||||
self.blacklist = False
|
||||
blacklistNames = []
|
||||
blacklistFile = "blacklist.json"
|
||||
if os.path.isfile(blacklistFile):
|
||||
blacklistNames = json.load(blacklistFile)["blacklist"]
|
||||
|
||||
for name in blacklistNames:
|
||||
for p in self.winners:
|
||||
if p.name == name:
|
||||
self.blacklist = True
|
||||
for p in self.losers:
|
||||
if p.name == name:
|
||||
self.blacklist = True
|
||||
|
||||
|
||||
if winnerSide == 2:
|
||||
self.winnerSideString = "Security"
|
||||
self.loserSideString = "Insurgent"
|
||||
|
||||
Reference in New Issue
Block a user