Disable deleting features while maintaining create and update in a referenced service

245
2
Jump to solution
11-26-2021 01:34 AM
Labels (2)
Clubdebambos
New Contributor II

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

 hosted_editing.JPG

This option does not exist when the data is referenced from a registered sde geodatabase. 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.

arcgis_pro_options.JPG

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? Any help appreciated. 

0 Kudos
1 Solution

Accepted Solutions
JonathanQuinn
Esri Frequent Contributor

For non-hosted services, you'd manage the capabilities via Server Manager:

JonathanQuinn_1-1638215036285.png

 

 

View solution in original post

0 Kudos
2 Replies
JonathanQuinn
Esri Frequent Contributor

For non-hosted services, you'd manage the capabilities via Server Manager:

JonathanQuinn_1-1638215036285.png

 

 

View solution in original post

0 Kudos
Clubdebambos
New Contributor II

Thank you @JonathanQuinn 

I had actually gone in there to try that and couldn't see the option to do that. But your screenshot showed me that I needed to highlight the Feature Access component.capabilities.JPG

Which then opens up those capabilities.

capabilities_2.JPG

Thank you.

0 Kudos