Mercurial > libervia-backend
diff sat/plugins/plugin_comp_file_sharing.py @ 3778:7b90d7c474fa
comp file sharing: handle `admins` in quotas
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 15 May 2022 14:15:24 +0200 |
parents | 75f8d206e551 |
children | 3ef988734869 |
line wrap: on
line diff
--- a/sat/plugins/plugin_comp_file_sharing.py Sun May 15 14:14:52 2022 +0200 +++ b/sat/plugins/plugin_comp_file_sharing.py Sun May 15 14:15:24 2022 +0200 @@ -410,13 +410,14 @@ 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):