editing – How to Disable Deleting Features in ArcGIS Portal Non-hosted Feature Services While Allowing Editing

arcgis-portaldisableeditingfeature-servicefeatures

When you host a feature service in Portal you can go to settings and turn on/off if features can be deleted (see below)

enter image description here

This option does not exist when the data is referenced from a registered sde geodatabase, as in a non-hosted feature service. When publishing from ArcGIS Pro there is no option for this either, I seem to recall there was in ArcMap where you could select using check boxes. I do not have access to ArcMap and required to publish via ArcGIS Pro.

enter image description here

I need to prevent users from deleting features and leave them with the ability to only edit current features and add new features. The data cannot be hosted and must be via a registered sde geodatabase.

I have exported the JSON of the service and can see that all capabilities are turned on.

"capabilities": "Query,Create,Update,Delete,Uploads,Editing,Sync,Extract"

I need to remove the Delete capability.

I have tried to update the capabilities using the Python API with the code below.

import json
from arcgis import GIS
from arcgis.features import FeatureLayer

## connect to Portal
conn = GIS(url="https://url/portal/home", username="username", password="password")

## access the fs via its id
item = conn.content.get('****')

## get the definition json
with open(r"path\to\update_test.json") as json_data:
    data = json.load(json_data)

## access the FeatureLayer components of the item
layer = FeatureLayer(item.url)
## update based on the json
layer.manager.update_definition(data)

I get the error…

Exception: Access to admin resources are not allowed
(Error Code: 403)

The JSON file has the following

{
    "capabilities": "Query,Create,Update,Uploads,Editing,Sync,Extract"
}

I have tested this on a hosted feature service and it works fine. So what is preventing me doing it on a referenced feature service with data published from a registered database?

Best Answer

Answered on ESRI Community board at https://community.esri.com/t5/arcgis-enterprise-portal-questions/disable-deleting-features-while-maintaining-create/m-p/1120953#M11774

For non-hosted services, you'd manage the capabilities via Server Manager. You need to highlight the Feature Access component and then you can turn off the delete capability. Save and Restart the service.

enter image description here

Related Question