geosolutions-it / ckanext-geonode

CKAN harvester for GeoNode instances
GNU General Public License v2.0
3 stars 0 forks source link

Replace Group mapping with Dynamic mapping #12

Open etj opened 2 years ago

etj commented 2 years ago

Old group mapping can be replaced with dynamic mapping rules, but it would be really verbose adding a Rule for each mapped group, where the only changing things are the source filter and the group value.

We want to add an optional mapping dict in the actionso that the value(s) got using the source jsonpath can be mapped to local values.

It means that instead of having one action of this kind for every group to be mapped:

{
    "filters": ["group.name=='REMOTE_GROUP'"], 
    "actions": [{
        "value": "LOCAL_GROUP", 
        "destination": "group"}
    ]
}

we may have a single Rule of this kind:

{
    "filters": [], 
    "actions": [{
        "source": "group.name",
        "mapping": {
            "REMOTE_GROUP1": "LOCAL_GROUP1",
            "REMOTE_GROUP2": "LOCAL_GROUP2",
            ...
        },
        "destination": "group"}
    ]
}

If the mapping is not found, the action will not be applied (i.e., no group will be associated by this rule)