diff options
Diffstat (limited to 'backend/utils.py')
-rw-r--r-- | backend/utils.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/backend/utils.py b/backend/utils.py index bab7ebe..1e23e63 100644 --- a/backend/utils.py +++ b/backend/utils.py @@ -57,3 +57,19 @@ def dirlisting(path, files, dirs): listing.append({"name": entry, "size": size}) return listing + +def cleanup(user, subdir): + directory = userdir(user) + subdir + "/" + print("Cleaning up %s" % (directory, )) + # TODO + # Remove contents + # Remove aliases + os.rmdir(directory) + return + +def aliases(user, subdir): + aliases = [] + data = db.cursor().execute("SELECT alias, access, storage, display FROM aliases WHERE user = :user AND real = :dir", {"user": user, "dir": subdir}).fetchall() + for alias in data: + aliases.append({"alias": alias[0], "access": alias[1], "storage": alias[2], "display": alias[3]}) + return aliases |