kitodo / kitodo-production

Kitodo.Production is a workflow management tool for mass digitization and is part of the Kitodo Digital Library Suite.
http://www.kitodo.org/software/kitodoproduction/
GNU General Public License v3.0
63 stars 63 forks source link

Add relation between import configurations and clients #6124

Closed solth closed 2 months ago

solth commented 2 months ago

Since import configurations can contain sensitive data like FTP credentials, they shouldn't be freely shared between clients. This pull request adds a relation between clients and import configurations similar to that between clients and projects, so that import configurations are explicitely mapped to specific lists of clients and users can only see and use those import configurations that are mapped to at least one of their assigned clients.

(since XSLT mapping files normally do not contain such sensitive data and are - like rulesets - available to all users via the file system anyway, a relation between clients and mapping files does not seem necessary and therefore has not been added)

The mapping between import configurations and clients can be edited via a new third tab named "Mandanten" ("Clients") on the import configuration edit page:

Bildschirmfoto 2024-07-12 um 14 05 53

The SQL migration file in this pull request that adds the corresponding cross table also assigns all existing import configurations to all existing clients by default to maintain the current status quo. An admin can then make use of the new functionality instroduced in this pull request and restrict access to specific configurations using the import configuration edit formular shown above.

Fixes #6059

solth commented 2 months ago

@henning-gerhardt thanks a lot for the remarks!

  1. It is possible to de-assign all clients from an import configuration. This import configuration becomes invisible but is still existing. Without manipulating the database table it is not possible anymore to interact with this hidden import configuration. In my opinion at least one client should be assigned to an import configuration.

Thanks for pointing this out. Indeed, it would become difficult to re-assign an import configuration that is not assigned to any client anymore. I see two ways to approach this:

What would be the better solution? Or do you have an alternative idea how to resolve this issue?

  1. If you have at least two clients Client_A and Client_B. You logged in in Client_A and de-assign an import configuration from Client_A so this import configuration should only assigned to Client_B, the import configuration is still visible while logged in in Client_A (even after re-log in). This behaviour is different to all the other client-depending relations like projects, process templates, workflows, ... Should this be the case?

This indeed sounds like a bug, e.g. wasn't intended. I will try to find the cause for this issue and resolve it. I got this wrong. I programmed it deliberately like this, but didn't realize the other object types you mentioned - project, template etc. - behaved differently. I guess if we can solve the first point you raised it shouldn't be a problem to only show those import configurations that are assigned to the current client and bring the functionality more in line with the rest of the system.

henning-gerhardt commented 2 months ago

I would go for the first option (special authority to "see" all available clients) even this behaviour is different then an other places like projects, process templates, ... but I think that sharing import configurations is more common than sharing projects, process templates, ... between clients.

henning-gerhardt commented 2 months ago

After a discussion between @solth and @henning-gerhardt we come to the following solution:

solth commented 2 months ago

@henning-gerhardt I updated the pull request as discussed: a new special permission was added that allows assigning import configurations to clients globally. The corresponding and new third "Clients" tab in the "Import configuration edit" page is now only rendered when the user has this new permission. On this third tab all clients are displayed and offered for assignement (not just those assigned to the current user/admin). Additionally, I added a new validator that ensures at least one client is assigned when saving the import configuration.