brainvisa / casa-distro

Unified development environment for BrainVISA projects.
2 stars 1 forks source link

site install: bv GUI configuration edition edits the read-only site config #336

Closed denisri closed 1 year ago

denisri commented 1 year ago

Describe the bug In a site install, the bv GUI configuration edition does not edit the personal config, but the environment config, which is shared and likely (and hopefully) read-only. Thus the user has not easy way to edit his own config, and the only way is to edit his global ~/.config/casa-distro/casa_distro3.json file, which is somewhat hidden, undocumented, and shared across all user casa-distro environments.

Environment:

ylep commented 1 year ago

This is a real issue, we should edit the shared configuration file in this case...

I imagine casa-distro could pass the path to the user's configuration through an environment variable, setting it to casa_distro.environment.user_config_filename() for read-only installs where HOME is in the user's home dir.

Should we set it to /casa/host/conf/casa_distro.json for shared environments, or also to casa_distro.environment.user_config_filename()? After all, the definition of mount points is more a function of the directories that exist on the host, so users are likely to want the same mount points to be defined for different environments... ?

denisri commented 1 year ago

Actually, for mount points, this is handled: in the GUI every mount point has a checkbox "global" which indicates whether the mount point should be defined in the environment config ("local" - but which is hared across users for a site install), or in the user config ~/.config/casa-distro/casa_distro3.json ("global" since it is shared across all environments for the user). For site install there is thus no user-specific, environment-specific config. But for other config variables we do not handle that (it's a different GUI), and only edit the environment config. Mount points are indeed the only variables stored in ~/.config/casa-distro/casa_distro3.json for now. But any other variables defined "by hand" there are also taken into account in casa-distro. Both config files are read (not sure in which order...) and merged in casa_distro run.

sapetnioc commented 1 year ago

In my opinion, the default behavior for users should be to edit their own configuration, not a shared one. This would avoid anyone messing someone else configuration by mistake. Modifying shared configuration is done by advanced users and we can accept that they have to do a quick GUI action before editing config of many users.

I think the configuration GUI should have two modes : user and site. In user mode all configurations are taken into account and user configuration is used to store modifications. In site mode, any user configuration is ignored and only shared values are displayed and saved.

This is probably too much change for next release. If I had to choose, I would have GUI only saving in user environment and advanced users eventually editing the configuration file in shared environments.

denisri commented 1 year ago

The thing is that the config does not decompose in user and site configs (this would be too simple). In casa-distro, the two configs are environment config and user config.

Thus the meaning of "environment config" changes depending if it is a user or site environment. Users will never overwrite a config shared by several users, unless the site install is wrong, because it will always be read-only for users. The problem is that no other config can be edited by users in the GUI. I'm working on it currently.