13 lines
566 B
Python
13 lines
566 B
Python
# Check if all the files needed by kjv-api (to write to) are also owned by the user running it.
|
|
# if this is not the same, writing to data/seq.db (and other undesirable behavior) is inevitable
|
|
# and will save a lot of headache in the future.
|
|
|
|
#Additionally, proper CHMOD value is 664 for the database
|
|
from os import stat, getuid
|
|
|
|
def check_sanity():
|
|
dependancies = ['data/seq.db', "data/shortcodes.db"]
|
|
current_uid = getuid()
|
|
for dependancy in dependancies:
|
|
if stat(dependancy).st_uid != current_uid:
|
|
raise PermissionError(dependancy) |