Make feature editable based on attribute value
Is it possible to use Access Control to make certain features within one feature layer editable based on an attribute value? Say I have two features in a layer, one with attribute (isEditable = True), the other one with attribute (isEditable = False). I only want my users to be able to edit the features with (isEditable = True): they should be able to view the other feature, but they should not be able to edit it.
Is it possible to write a custom rule in Access Control that takes care of this situation?
-
In theory yes, but it would be quite difficult and might not work well in most practical cases.
It is possible in Advanced Permissions to use JavaScript to examine requests to an ArcGIS Server service. You could create an Advanced Permissions that:
- Detects all edit requests (based on the URL).
- Examines the edit request body to see what features are being edited.
- Use whatever logic you like to decide whether to allow the edit(s).
- Allow or deny the request.
However, there are a couple issues:
- There are several different ArcGIS Server endpoints that can perform edits, so your JavaScript would have to be able to detect them all and parse the payloads from them.
- The client application won't have any way to know which specific features are editable ahead of time. As far as the client is concerned a layer is editable or not. The client application would likely still offer the user interface to edit any feature. Some of those edits would just fail and there might not be great feedback for the user.
--Ryan
2 -
I was trying to do this, but I can't get it to work. I'm pretty sure my code is incorrect…
But I was also wondering if this is really possible. Can Access Control evaluate the current value of the field, before it is being edited and then deny an edit based on that value? Won't Access Control only see the new value and therefor only make is possible to deny an edit based on that new value?
If it is possible (even if there are some issues a pointed out by Ryan) I would really like some help with the code. Does anyone have an example?
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
2 commentaires