Bug 14296

Summary: Introduce upload settings, add quota and translate alerts
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: ToolsAssignee: Marcel de Rooy <m.de.rooy>
Status: ASSIGNED --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: indradg, katrin.fischer, mirko
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14294
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 14296: Introduce upload settings [database revision]
Bug 14296: Introduce upload settings, check size and translate alerts
Bug 14296: Add checks for upload quota
Bug 14296: Add checks for upload quota

Description Marcel de Rooy 2015-05-29 09:55:58 UTC

    
Comment 1 Marcel de Rooy 2015-05-29 11:10:50 UTC
Created attachment 39669 [details] [review]
Bug 14296: Introduce upload settings [database revision]

This patch adds the table upload_settings. An interface for this table
will be created on a subsequent report. The table will be used first to
implement a check on upload size and quota.

The table allows to add settings on a general level (no borrower) and
on a (staff) user level overriding general settings.

Test plan:
Run new install or upgrade in the webinstaller. You can also run the sql
files from the command line.
Comment 2 Marcel de Rooy 2015-05-29 11:11:25 UTC
Created attachment 39670 [details] [review]
Bug 14296: Introduce upload settings, check size and translate alerts

This patch includes:
[1] Add sub MaxUploadSize to module and add unit test.
    Note that normally the table will still be empty, but a large
    fallback is used.
[2] Check the max upload size for the user when submitting the form and
    again when processing it.
[3] Make it possible to translate some alerts in upload.tt. Also it moves
    the input[type=file] control to the template.

Test plan:
[1] Upload a file. No restrictions.
[2] Run UploadedFiles.t.
[3] Add a record (sorry, interface is another report) via mysql into
    upload_settings: type=filesize, count1=1000.
[4] Upload a file larger than 1000 bytes. Should not be possible.
[5] Upload a smaller file.
[6] Bonus: I tested the second size check by adding a return true in the
    javascript validation after the first size check.
Comment 3 Marcel de Rooy 2015-06-02 12:09:40 UTC Comment hidden (obsolete)
Comment 4 Marcel de Rooy 2015-06-02 12:13:27 UTC
One moment..
Comment 5 Marcel de Rooy 2015-06-02 12:39:13 UTC
Created attachment 39768 [details] [review]
Bug 14296: Add checks for upload quota

This patch includes:
[1] A new routine CheckQuota in module UploadedFiles.
[2] Unit tests for CheckQuota in Uploadedfiles.t
[3] A check of the quota before uploading a file in upload.pl and a warning
    in the template if you exceeded these quota already.

Test plan:
[1] Delete all records from upload_settings (if any).
[2] Upload a file. No restrictions.
[3] Add a record in upload_settings with type=spacequota, count1=5000 and
    count2=1. (Yes, an interface will be added.)
[4] Upload a file smaller than 5000 bytes. No restriction.
[5] Upload another file making sure that the size of both files exceeds
    5000 bytes. Your upload should be stopped.
[6] Run the unit test with additional item and space quota tests.
Comment 6 Mirko Tietgen 2015-11-20 17:09:32 UTC
Marked as blocked, but does not say what it depends on. Is the status correct?
Comment 7 Katrin Fischer 2015-11-20 18:56:57 UTC
Hm, no dependency either - Marcel set the status himself.
Comment 8 Marcel de Rooy 2015-11-23 13:44:21 UTC
(In reply to Mirko Tietgen from comment #6)
> Marked as blocked, but does not say what it depends on. Is the status
> correct?

Yes, I changed it. I will come back to this dev, as soon as time permits :)
It certainly will need rebasing since I gave priority to bug 14321..
Comment 9 Katrin Fischer 2016-06-27 06:16:40 UTC
Should this be unblocked?
Comment 10 Marcel de Rooy 2016-06-27 06:38:44 UTC
(In reply to Katrin Fischer from comment #9)
> Should this be unblocked?

This will need some adjustments. Back to Assigned
Comment 11 Indranil Das Gupta 2017-06-25 09:56:23 UTC
Marcel: I've a client who needs to restrict download / view access to the uploaded files exposed via the OPAC (856$u) to only authenticated users. I was wondering if this patch of yours can be extended to that end. Or should I open a new report and work on it?

Please advice.
Comment 12 Marcel de Rooy 2017-06-26 07:34:04 UTC
(In reply to Indranil Das Gupta from comment #11)
> Marcel: I've a client who needs to restrict download / view access to the
> uploaded files exposed via the OPAC (856$u) to only authenticated users. I
> was wondering if this patch of yours can be extended to that end. Or should
> I open a new report and work on it?
> 
> Please advice.

No, this report does not deal with that. I would recommend opening another report.
Comment 13 Katrin Fischer 2023-08-05 11:33:46 UTC
Looks like 3 bugs in one, but stuck - worth getting unstuck?