-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Assign resource ownership to administrator during resource creation configurable via settings #13965
Description
📝 Introduction
User Story:
As a User, I want to assign the reosurce ownership to the administrator during the resource creation, by defining the username in the settings file.
Problem Statement:
Not all the plaform wants the user that upload the resource to be the owner of the resource itself, but wants that the administrator will be the only owner of the resources in the platform.
At the moment this is not possible since by default the user creates a resource the data is always the owner of the resource itself.
The idea is to create a system where, by specifing few settings, the system will automatically assing the ownership of the resource to the administrator and assign the "manage" permissions to the user itself.
Ideally will be possible to define the following two settings in the application:
AUTO_ASSIGN_RESOURCE_OWNERSHIP_TO_ADMIN = os.getenv("AUTO_ASSIGN_RESOURCE_OWNERSHIP_TO_ADMIN", "False") # define if the function is enabled
RESOURCE_OWNERSHIP_ADMIN_USERNAME = os.getenv("RESOURCE_OWNERSHIP_ADMIN_USERNAME", "admin") # define the username of the administrator to assing the ownership toNOTE: The above configuration MUST be value and choerent with all the resource available
✅ Criteria
- Settings setup: It will be possible to set the two envs.
- Consistency and warnings: If the
AUTO_ASSIGN_RESOURCE_OWNERSHIP_TO_ADMINis set butRESOURCE_OWNERSHIP_ADMIN_USERNAMEis not, we should log a warning in the settings file (via log) which sayis that the ownership will be provided to the default usernameadmin - User evaluation: the user defined in
RESOURCE_OWNERSHIP_ADMIN_USERNAMEmust be a superuser. The evaluation of the can be done during the creation. If the user provided is not ad administrator, the system should log an error and assign the resource to the first admin available. - Permissions assign: The user defined in
RESOURCE_OWNERSHIP_ADMIN_USERNAMEshould be the owner of the resource, while the initial user must have themanagepermissions. If later the permissions are altered via thesharepanel, the new permissions must be set - Code consistency: the method responsible to manage this, should be defined as a handler in the permissions registry and it must override any other permission defined by default in GeoNode
- Creation only: the above should not be applied if the user update the resource (example via the metadata editor) but only during the creation phase