Select to view content in your preferred language

Use attribute rules to limit access rights

447
1
05-03-2022 10:04 PM
mody_buchbinder
Frequent Contributor

I would like to use attribute rules to implement some way to limit edits by people.

The data is within enterprise geodatabase (oracle) and is updated by Pro.

For example some user can create a line not longer then 1 KM while other can create a line up to 2KM long.

The attribute rue should get the user (active directory user). Go to some external table (not necessary in the same schema as the layer), find if the user belong to the first or second group. Check the line that was created and improve or reject the new feature.

Can something like that be done in Arcade as attribute rule?

Thanks

1 Reply
jcarlson
MVP Esteemed Contributor

You could certainly do something like that.

For the user portion, the GetUser function is precisely what you need. As far as the external table, pulling in that information really depends on where and how it's stored, but FeatureSetByPortalItem is the most flexible function for getting another layer, since it can grab any published service.

You could also just hard-code the user lists into the attribute rule itself, which would probably perform better than making repeated calls to another table. But the external table has the benefit of being editable without having to alter the attribute rule expression, so I can see wanting to go that route, too.

var the_user = GetUser(your_layer_object)['username']

var g1_users = [
    'JohnDoe',
    'JaneDoe',
    'JoshCarlson'
]

var g2_users = [
    'JohnQPublic',
    'Kilroy'
]

if (Includes(g1_users, the_user)){

    // some kind of validation specific to group 1

} else if (Includes(g2_users, the_user)){

    // some kind of validation specific to group 2

} else {

    // fallback response for unmatched user

}

 

- Josh Carlson
Kendall County GIS