Bug 14686: Add allows_add_by to check permissions for uploading
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Mon, 14 Mar 2016 12:22:14 +0000 (13:22 +0100)
committerBrendan Gallagher <bredan@bywatersolutions.com>
Wed, 27 Apr 2016 16:14:16 +0000 (16:14 +0000)
commitb69402d14cd83ebedfd1272f9a42c4ceacfa60db
tree2acf871db2b7fe19ee780f4503044105a5bb1ad5
parenta25bfbfc574ac41a8a570a9a9b01716291d5a0dc
Bug 14686: Add allows_add_by to check permissions for uploading

The three permissions in tools/upload-file.pl are moved to a custom
routine in DBIx's UploadedFile.pm. An additional granular permission
upload_general_files is added. (The dbrev patch will contain it too.)
At some point in time this could be moved to a Koha::Object class.

The routine is tested in Upload.t.

Test plan:
[1] Run t/db_dependent/Upload.t
[2] If you only apply this patch, you can also test uploading with a
    user that has edit_catalogue but does not have tools or circulate.
    Upload status should say: Denied.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
Koha/Schema/Result/UploadedFile.pm
t/db_dependent/Upload.t
tools/upload-file.pl