From 939226c93e6545481129e4a4842349f32029de97 Mon Sep 17 00:00:00 2001 From: Zacharias Zacharodimos Date: Thu, 14 Sep 2023 13:21:20 +0200 Subject: [PATCH] files: set bucket quota --- .../records/systemfields/files/manager.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/invenio_records_resources/records/systemfields/files/manager.py b/invenio_records_resources/records/systemfields/files/manager.py index 9587f0ea..fb91555b 100644 --- a/invenio_records_resources/records/systemfields/files/manager.py +++ b/invenio_records_resources/records/systemfields/files/manager.py @@ -131,6 +131,14 @@ def set_bucket(self, bucket, overwrite=False): setattr(self.record, self._options["bucket_id_attr"], bucket.id) self._bucket = bucket + def set_quota(self, quota_size, max_file_size=None): + """Set bucket quota.""" + if self.bucket is not None: + assert not self.bucket.locked + self.bucket.quota_size = quota_size + if max_file_size: + self.bucket.max_file_size = max_file_size + def lock(self): """Lock the bucket.""" self.bucket.locked = True