qwc-services / qwc-admin-gui

QWC Admin GUI
MIT License
1 stars 17 forks source link

Import resources and permissions from Map resource #54

Closed benoitblanc closed 2 years ago

benoitblanc commented 2 years ago

This PR aims to automatically import resources and permissions from Map resource.

In Resources, there is a new button for resources of type Map:

image

User can chose type of resources which will be imported as resources in database. Available types are are layer, data, data_read, data_create, data_update and data_delete.

Roles are the ones existing in database.

image

Resources are imported from parent resource id.

Permissions are also added for the role for all the resources that are imported.

image

This feature is quite the same than the Import layers button when you edit a Map resource but you can directly choose type and permissions.

manisandro commented 2 years ago

Nice! @mwa Looks good to you also?

tpo commented 2 years ago
  1. I can understand the resource types "layer" and "data". However, what are the resource types "data_read, data_create, data_update and data_delete"? I'm a GIS noob, so maybe I am asking a thing that is absolutely obvious for a GIS user, then you might want to ignore the question...
  2. Is there any documentation coming along with the commit? Of course you know what your commit does, however does the typical Admin GUI user also know? I'd say that as a start the nice screenshots and an adapted version of the text of this pull request could be included as docu in the Admin GUI?

Note that I am not a maintainer of the Admin GUI, so I have no say whether this pull request gets included or not. I'm only a person that sometimes needs to use the Admin GUI, sometimes needs to do a bit of support for someone else who's wondering what all those things in the Admin GUI do, and now I actually have some implicit knowledge of what some of the things of the Admin GUI do. Having access to actual documentation for the Admin GUIs features via a "Help" or "Info" button would elevate this software's usability.

benoitblanc commented 2 years ago

Hi @tpo ,

I can understand the resource types "layer" and "data". However, what are the resource types "data_read, data_create, data_update and data_delete"? I'm a GIS noob, so maybe I am asking a thing that is absolutely obvious for a GIS user, then you might want to ignore the question...

From what I understand, end-user with admin role could create layer resources to give read access to some layers to some users/roles in QWC application. Admin could also create data resources from layers in QGIS project, to give write access to some layers to some users/roles in QWC application. In qwc-config-generator, service generates forms only for data resources, not for layer resources. Differences between data_create, data_read, data_update, data_delete are for the end-user interface when user wants to edit a layer. Some buttons are enabled/visible regarding if it is data_create, data_read, data_update, data_delete.

For example, with "commune" as data_read resource, in Edit plugin, you have only button for Attribute Table.

image

For example, with "commune" as data_create resource, in Edit plugin, you have button for Attribute Table and button for Drawing a new object in the layer.

image

For example, with "commune" as data_update resource, in Edit plugin, you have button for Attribute Table and button for Picking an object to update geometry and/or attributes.

image

There are the same Attribute and Pick buttons for "commune" as data_delete but user could only delete objects in the layer, not update attributes or geometry.

image

If you have "commune" as data resource, it is all these types at the same time so you have all the buttons available in Edit plugin.

image

Is there any documentation coming along with the commit? Of course you know what your commit does, however does the typical Admin GUI user also know? I'd say that as a start the nice screenshots and an adapted version of the text of this pull request could be included as docu in the Admin GUI?

No there is no documentation about this commit. You are right, it is not obvious for the end-user (admin role) to know what it does when clicking "Import Resources". I think it would be great to add all these screenshots + texts as doc in Admin GUI, but it is an User Documentation, not a Dev Doc as the README.md looks like. Where do we create this doc ?

Note that I am not a maintainer of the Admin GUI, so I have no say whether this pull request gets included or not. I'm only a person that sometimes needs to use the Admin GUI, sometimes needs to do a bit of support for someone else who's wondering what all those things in the Admin GUI do, and now I actually have some implicit knowledge of what some of the things of the Admin GUI do. Having access to actual documentation for the Admin GUIs features via a "Help" or "Info" button would elevate this software's usability.

I totally agree with your point of view concerning the lack of documentation (user and dev points of view) and it would be great to enhance all QWC environment documentation to make this software easier to use and deploy. Could the documentation be written in https://github.com/qwc-services/qwc-services.github.io repository ? With a Dev point of view and an User one.

benoitblanc commented 2 years ago

Hi @manisandro ,

Is this ok to merge ? I will create documentation for the admin service later.

Thanks

manisandro commented 2 years ago

I'd like @mwa to give it a look first

mwa commented 2 years ago

Looks great, thanks

tpo commented 2 years ago

@mwa - kannst Du bitte noch das hier kommentieren: https://github.com/qwc-services/qwc-admin-gui/pull/54#issuecomment-1275678996 ?

mwa commented 2 years ago

@tpo The data_create, data_read, data_update and data_delete resource types allow setting more detailed permissions for each CRUD action, e.g. if some user roles are allowed to create new features but not delete them. They may be used instead of the more general data resource type (read-only permissions if the write flag is not set, or full write permissions if it's set).