Select to view content in your preferred language

Filter data within a layer based on user's role

4296
4
06-01-2016 08:41 AM
FabioD_Ovidio
Emerging Contributor

Hello,

is there any sample about SOI to filter data within a layer based on the user's role?

Thank you in advance

Fabio

Tags (2)
0 Kudos
4 Replies
nicogis
MVP Frequent Contributor

you can see the sample in sdk arcobjects:

C:\Program Files (x86)\ArcGIS\DeveloperKit10.4\Samples\ArcObjectsNet\ServerLayerAccessSOI

0 Kudos
FabioD_Ovidio
Emerging Contributor

Hi, thanks!

I need anyway a sample about data access inside a layer (so filter rows based on user role). Do you know anyone?

Thank you

Fabio

0 Kudos
nicogis
MVP Frequent Contributor

you can see this sample devsummit-berlin-2015-SOI/FilterAccessSOI at b6b41e77f873ffd0b1c868cb04dc754cb37f58e1 · ceddc/devsum...  and use layerDefs  of ExportMap Rest to filter rows using a definition expressions

0 Kudos
Amir-Sarrafzadeh-Arasi
Frequent Contributor

Dear Fabio,

I hope you are doing well,

You should first get the user role with this code ("java"):

var roles = ServerUtilities.getServerUserInfo().getRoles();
var role = roles.next();
 

variable rules icludes roles of the user which is entered and then the id_groups of the user who is member of them, so if you want to get the id_groups of the groups you should do .next() again.

the you should create a JSONObject and define the whereclause and put in it:

JSONObject inputParams = new JSONObject(operationInput);
inputParams.put("where", "Here you should put your clause in SQL format");
operationInput = inputParams.toString();

  if you want to filter specific layers of specific field you can use these codes,

inputParams.put("layers", "0");
inputParams.put("layerDefs", layerDefs);

Best regards.

Amir Sarrafzadeh Arasi
0 Kudos