Ticket #812 (closed Enhancement: fixed)

Opened 9 years ago

Last modified 8 years ago

File upload quota

Reported by: jri Owned by: jri
Priority: Major Milestone: Release 4.7
Component: DeepaMehta Standard Distribution Version: 4.6.1
Keywords: Cc: dgf, Malte, JuergeN
Complexity: 3 Area:
Module: deepamehta-files

Description

A per-user file upload quota should be enforced.

Change History

comment:1 Changed 9 years ago by jri

  • Status changed from new to accepted

comment:2 Changed 9 years ago by Jörg Richter <jri@…>

In df03573f00dec8360b0c40952af217bac2bb2466/deepamehta:

Enforce per-user file upload quota (#812).

New config property:

dm4.filerepo.user_quota

Per-user file upload quota in MB.
Default is 150.

The quota is enforced by the UploadedFile?.write() method.
Your plugin should use this method to write an uploaded file to disc.

The disc space occupied by a user is calculated by retrieving all File topics where that user is the creator. Then the size of the underlying file is get by asking the file system (not by the File topic's Size field). Files for which no File exists are not respected in the calculation.

Your plugin should make sure to create the corresponding File topic when writing a file to disc. Using the FilesService?'s storeFile() method is recommended. Note: POSTing a file to /files service is not mandatory to upload a file. Your plugin can receive an upload, process it in some way, and then possibly call the FilesService?'s storeFile() method.

See #812.

comment:3 Changed 9 years ago by Jörg Richter <jri@…>

In aa4fd0d4a00dfc755b42036c14c2649d1da969cd/deepamehta:

Static core service access (#812).

The DM Core Service can be statically accessed from everywhere:

import de.deepamehta.core.osgi.CoreActivator;

DeepaMehtaService dms = CoreActivator.getDeepaMehtaService()

This is useful e.g. in JAX-RS provider classes.

See #812.

comment:4 Changed 9 years ago by Jörg Richter <jri@…>

In c4e002a3bcfa706d432d275da51521ef173c43a8/deepamehta:

Files plugin: add per-user quota config (#812).

Username topics offer a "Configure -> Disk Quota" command to edit the per-user disk quota (in MB). If no per-user quota is set the global setting applies (150 MB).

The per-user quota setting is not yet respected.

See #812.

comment:5 Changed 9 years ago by Jörg Richter <jri@…>

In 9b61e1205c2512bd45d033db5bc255da10ae7180/deepamehta:

Rename global disk quota config property (#812).

1 config property renamed:

dm4.filerepo.user_quota -> dm4.filerepo.disk_quota

Standard disk quota (for file uploads) allocated to each user (in MB).

Individual (per-user) disk quotas can be configured by the Username topic's "Configure -> Disk Quota" command.

See #812.

comment:6 Changed 9 years ago by Jörg Richter <jri@…>

In 4a07396289b0f043ab9a3e400d94bcc44b29873f/deepamehta:

Enforce per-user disk quota config (#812).

The individual (per-user) disk quota as configured by a Username topic's "Configure -> Disk Quota" command is now enforced.

CHANGES

Core API:

1 new method in AccessControl?:

Topic getUsernameTopic(HttpServletRequest request)

Convenience method that returns the Username topic that corresponds to a request.
Basically it calls getUsernameTopic(getUsername(request)).

1 new static method in CoreActivator?:

<S> S getService(Class<S> clazz)

Returns a registered OSGi service.

See #812.

comment:7 Changed 9 years ago by Jörg Richter <jri@…>

In f0c7de481dec0d6f363c80593027f6f35354d0bc/deepamehta:

Config plugin: support ADMIN role (#830, #812).

Config modification role ADMIN is now supported: Config topics defined with that role can only be modified by admins.

The remaining config modification roles (CREATOR, OWNER, MEMBER) are not yet supported.

Files plugin: the individual (per-user) disk quota can be modified by admins only.

See #830.
See #812.

comment:8 Changed 9 years ago by jri

  • Status changed from accepted to closed
  • Resolution set to fixed

comment:9 Changed 9 years ago by jri

  • Status changed from closed to reopened
  • Resolution fixed deleted

An admin should be able to disable the disk quota by setting a value of -1.

This should be supported for both, the global setting (dm4.filerepo.disk_quota) and the per-user setting ("Configure" command in the webclient).

comment:10 Changed 9 years ago by Jörg Richter <jri@…>

In 5c79030b0144e93ba791b5fbcb09a46defd15fcc/deepamehta:

Files: optionally disable disk quota (#812).

An admin can disable the disk quota by setting -1 as value.

This is supported for both, the global setting (config property dm4.filerepo.disk_quota) and the per-user setting ("Configure" command in the webclient).

Note: the global disk quota setting affects new accounts only. If the global disk quota is changed (and DM is restarted) existing user accounts keep their original disk quota.

See #812.

comment:11 Changed 9 years ago by Jörg Richter <jri@…>

In 9866b2429249357387ac65a8deb64fab84962276/deepamehta:

Files: disbale disk quota by default (#812).

By default the disk quota is disabled (-1). Formerly it was 150 MB.

This is because the DM Standard Distribution's default configuration reflects a single-user installation and a disk quota makes no sense here.

For a multi-user installation on the other hand the administrator is required to adapt several configuration values anyway. There is no reasonable default value for disk quota.

See #812.

comment:12 Changed 9 years ago by jri

  • Status changed from reopened to closed
  • Resolution set to fixed

comment:13 Changed 8 years ago by Jörg Richter <jri@…>

In 93f9346c255fbcc1fdc46779d64adb6c201e05a5/deepamehta:

Files module: fix default disk quota (#812).

The disk quota is off (-1) also if DM is started via feature:install from Karaf.

See #812.

Note: See TracTickets for help on using tickets.