Difference between revisions of "GeoFence library"
From Gcube Wiki
(→createUser(User user)) |
(→User section) |
||
Line 26: | Line 26: | ||
GSUser user = gf.getUserById(id); | GSUser user = gf.getUserById(id); | ||
String userName = user.getName(); | String userName = user.getName(); | ||
+ | </source> | ||
+ | |||
+ | ===getUserByUsername(String userName)=== | ||
+ | |||
+ | Parameters List : | ||
+ | *"userName" : [String value] It's the name of user you are looking for; | ||
+ | |||
+ | '''Invocation example''' | ||
+ | <source lang="java5"> | ||
+ | String userName = ...; | ||
+ | GSUser user = gf.getUserByUsername(userName); | ||
+ | String id = user.getId(); | ||
</source> | </source> | ||
Line 41: | Line 53: | ||
... | ... | ||
HttpStatus status = gf.createUser(user); | HttpStatus status = gf.createUser(user); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</source> | </source> | ||
==Group section== | ==Group section== |
Revision as of 16:03, 21 November 2017
This section aims to describe the Geofence library in order to help developers to manage users, groups, rules and instances in Geofence server. After configuring between Geofence server with GeoServer, for instance, it's possible create an user in Geofence and automatically it's possible to login (with this user) in GeoServer. Following is a list of methods, with all details to uderstand how invoke them.
Contents
Constructor
Parameters List :
- "geofenceRestUrl" : [String value] The URL of Geofence instance;
Invocation example
GeoFence gf = new GeoFence("http://geofenceRestUrl/");
User section
getUserById(String id)
Parameters List :
- "id" : [String value] It's the userId of user you are looking for;
Invocation example
String id = ...; GSUser user = gf.getUserById(id); String userName = user.getName();
getUserByUsername(String userName)
Parameters List :
- "userName" : [String value] It's the name of user you are looking for;
Invocation example
String userName = ...; GSUser user = gf.getUserByUsername(userName); String id = user.getId();
createUser(User user)
Parameters List :
- "user" : [User value] It's the org.gcube.data.access.bean.User object you are creating;
Invocation example
User user = new User(); user.setExtId("id_1"); user.setName("test_1"); user.setPassword("test"); ... HttpStatus status = gf.createUser(user);