if self.data.bugzilla_api_key:
return bugtracker.Bugzilla(self.backend, self.data.bugzilla_api_key)
- # Quota
+ # Storage Quota
- def get_quota(self):
- return self.data.quota
+ def get_storage_quota(self):
+ return self.data.storage_quota
- def set_quota(self, quota):
- self._set_attribute("quota", quota)
+ def set_storage_quota(self, quota):
+ self._set_attribute("storage_quota", quota)
- quota = property(get_quota, set_quota)
+ storage_quota = property(get_storage_quota, set_storage_quota)
- def has_exceeded_quota(self, size=None):
+ def has_exceeded_storage_quota(self, size=None):
"""
Returns True if this user has exceeded their quota
"""
# Skip quota check if this user has no quota
- if not self.quota:
+ if not self.storage_quota:
return
- return self.disk_usage + (size or 0) >= self.quota
+ return self.disk_usage + (size or 0) >= self.storage_quota
- def check_quota(self, size=None):
+ def check_storage_quota(self, size=None):
"""
Determines the user's disk usage
and raises an exception when the user is over quota.
"""
# Raise QuotaExceededError if this user is over quota
- if self.has_exceeded_quota(size=size):
+ if self.has_exceeded_storage_quota(size=size):
raise QuotaExceededError
@lazy_property
deleted_at timestamp without time zone,
registered_at timestamp without time zone DEFAULT now() NOT NULL,
admin boolean DEFAULT false NOT NULL,
- quota bigint,
+ storage_quota bigint,
perms text[] DEFAULT ARRAY[]::text[] NOT NULL,
_attrs bytea,
bugzilla_api_key text
{% if user.has_perm(current_user) %}
<div class="level-item has-text-centered">
<div>
- {% if user.quota %}
+ {% if user.storage_quota %}
<p class="heading">{{ _("Disk Quota") }}</p>
- <p class="title {% if user.has_exceeded_quota() %}has-text-danger{% end %}">
- {{ format_size(user.disk_usage) }}/{{ format_size(user.quota) }}
+ <p class="title {% if user.has_exceeded_storage_quota() %}has-text-danger{% end %}">
+ {{ format_size(user.disk_usage) }}/{{ format_size(user.storage_quota) }}
</p>
{% else %}
<p class="heading">{{ _("Disk Usage") }}</p>
"email" : [b"joe.tester@ipfire.org"],
})
- # Set a quota
- self.user.quota = 104857600 # 100 MiB
+ # Set storage quota
+ self.user.storage_quota = 104857600 # 100 MiB
# Create a distribution
self.distro = self.backend.distros.create("Default Test Distribution", "test", 1)