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):
|
||||
"""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", {})
|
||||
entity_bare_s = entity.userhost()
|
||||
try:
|
||||
quota = quotas["jids"][entity_bare_s]
|
||||
except KeyError:
|
||||
quota = quotas.get("users")
|
||||
if self.host.memory.isAdminJID(entity):
|
||||
quota = quotas.get("admins")
|
||||
else:
|
||||
try:
|
||||
quota = quotas["jids"][entity.userhost()]
|
||||
except KeyError:
|
||||
quota = quotas.get("users")
|
||||
return None if quota is None else utils.parseSize(quota)
|
||||
|
||||
async def generate_thumbnails(self, extra: dict, image_path: Path):
|
||||
|
|
|
|||
Loading…
Reference in a new issue