comp file sharing: handle admins in quotas
This commit is contained in:
parent
c8025a52eb
commit
f4fa679e9c
1 changed files with 7 additions and 6 deletions
|
|
@ -410,13 +410,14 @@ class FileSharing:
|
||||||
|
|
||||||
def getQuota(self, client, entity):
|
def getQuota(self, client, entity):
|
||||||
"""Return maximum size allowed for all files for entity"""
|
"""Return maximum size allowed for all files for entity"""
|
||||||
# TODO: handle special entities like admins
|
|
||||||
quotas = self.host.memory.getConfig("component file-sharing", "quotas_json", {})
|
quotas = self.host.memory.getConfig("component file-sharing", "quotas_json", {})
|
||||||
entity_bare_s = entity.userhost()
|
if self.host.memory.isAdminJID(entity):
|
||||||
try:
|
quota = quotas.get("admins")
|
||||||
quota = quotas["jids"][entity_bare_s]
|
else:
|
||||||
except KeyError:
|
try:
|
||||||
quota = quotas.get("users")
|
quota = quotas["jids"][entity.userhost()]
|
||||||
|
except KeyError:
|
||||||
|
quota = quotas.get("users")
|
||||||
return None if quota is None else utils.parseSize(quota)
|
return None if quota is None else utils.parseSize(quota)
|
||||||
|
|
||||||
async def generate_thumbnails(self, extra: dict, image_path: Path):
|
async def generate_thumbnails(self, extra: dict, image_path: Path):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue