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.
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.
Created attachment 39766 [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.
One moment..
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.
Marked as blocked, but does not say what it depends on. Is the status correct?
Hm, no dependency either - Marcel set the status himself.
(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..
Should this be unblocked?
(In reply to Katrin Fischer from comment #9) > Should this be unblocked? This will need some adjustments. Back to Assigned
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.
(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.
Looks like 3 bugs in one, but stuck - worth getting unstuck?