georchestra / mapstore2-georchestra

geOrchestra newest viewer
Other
6 stars 23 forks source link

[FeatureEditor] - EditingAllowedRoles by attribute #686

Closed Gaetanbrl closed 5 months ago

Gaetanbrl commented 6 months ago

This enhancement is suggested by Geo2France (@vfabry @Doctor-Who)

Targeted version

>= release https://github.com/georchestra/mapstore2-georchestra/releases/tag/2023.02.00-RC4-geOrchestra

Linked issue

MapStore2 issue will be create soon

Description

Currently, FeatureEditor plugin allow to restrict modifications to some roles via editionAllowedRoles config.

Here an example from current behavior where ROLE_A and ADMIN can fullly edit geometry and every attributes :

{
  "name": "FeatureEditor",
  "cfg": {
    "editingAllowedRoles": ["ADMIN", "ROLE_A"]
  }
}

But in some cases, It may be useful for a list of roles to restrict input by attribute.

So, we propose to insert a new config to allow one (or many) ROLES to edit a specific attribute in MapStore (not all the layer).

Here, an example where :

{
  "name": "FeatureEditor",
  "cfg": {
    "customEditorsOptions": {
      "rules": [
        {
          "regex": {
            "attribute": "COMMENTS",
            ...
          },
          "editingAllowedRolesByAttribute": ["ROLE_B"]
        },
        {
          "regex": {
            "attribute": "CATEGORY",
            ...
          }
        }
      ]
    },
    "editingAllowedRoles": ["ADMIN", "ROLE_A"]
  }
}

For this enhancement, please note that :

What kind of improvement you want to add? (check one with "x", remove the others)

Other useful information

Code / doc ref

https://github.com/geosolutions-it/MapStore2/blob/fe79d86b843f7fc8619bf01aa7d129df7ee755ac/web/client/components/data/featuregrid/enhancers/editor.js#L86

https://mapstore.geosolutionsgroup.com/mapstore/docs/api/framework#components.data.featuregrid.editors.customEditors

Gaetanbrl commented 5 months ago

I close. More details are available here : https://groups.google.com/u/1/g/mapstore-users/c/KMGdU8Psyco