from .decorators import *
+DEFAULT_STORAGE_QUOTA = 256 * 1024 * 1024 # 256 MiB
+
# Setup logging
log = logging.getLogger("pbs.users")
return results[0]
- def create(self, name, notify=False, _attrs=None):
+ def create(self, name, notify=False, storage_quota=None, _attrs=None):
"""
Creates a new user
"""
if _attrs:
_attrs = pickle.dumps(_attrs)
+ # Set default for storage quota
+ if storage_quota is None:
+ storage_quota = DEFAULT_STORAGE_QUOTA
+
user = self._get_user("""
INSERT INTO
- users(
- name,
- _attrs
- )
+ users
+ (
+ name,
+ storage_quota,
+ _attrs
+ )
VALUES
- (%s, %s)
+ (
+ %s, %s, %s
+ )
RETURNING
*
- """, name, _attrs,
+ """, name, storage_quota, _attrs,
)
log.debug("Created user %s" % user)