Difference between revisions of "GeoFence library"

From Gcube Wiki
Jump to: navigation, search
(Invocation details)
(User section)
Line 29: Line 29:
 
</source>
 
</source>
  
*getUserByUsername(String userName)
+
====getUserByUsername(String userName)====
<pre>
+
Parameters:
+
    userName - It's the name of user you are looking for.
+
Returns:
+
    GSUser object.
+
</pre>
+
  
*createUser(User user)
+
Parameters List :  
<pre>
+
*"userName" : [String value] It's the name of user you are looking for;
Parameters:
+
    user - It's the User object you are creating.
+
Returns:
+
    HttpStatus object.
+
</pre>
+
  
*updateUser(User user)
+
====Invocation example====
<pre>
+
<source lang="java5">
Parameters:
+
String userName = ...;
    user - It's the User object you are updating.
+
GSUser user = gf.getUserByUsername(userName);
Returns:
+
String id = user.getId();
    HttpStatus object.
+
</source>
</pre>
+
 
+
*updateUserById(String id, String password, String email, boolean admin, boolean enabled)
+
<pre>
+
Parameters:
+
    id - It's the id of user.
+
    password - It's the password of user.
+
    email - It's the email of user.
+
    admin - It's the boolean flag to define if user is administrator or not.
+
    enabled - It's the boolean flag to define if user is enabled or not.
+
Returns:
+
    HttpStatus object.
+
</pre>
+
  
 
==Group section==
 
==Group section==

Revision as of 16:46, 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.


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();

Group section