diff --git a/src/main/java/net/tirasa/syncoperestclient/App.java b/src/main/java/net/tirasa/syncoperestclient/App.java index b11c3b9..4598706 100644 --- a/src/main/java/net/tirasa/syncoperestclient/App.java +++ b/src/main/java/net/tirasa/syncoperestclient/App.java @@ -11,6 +11,7 @@ import org.apache.syncope.client.SyncopeClient; import org.apache.syncope.client.SyncopeClientFactoryBean; import org.apache.syncope.common.mod.AttributeMod; +import org.apache.syncope.common.mod.UserMod; import org.apache.syncope.common.services.ConfigurationService; import org.apache.syncope.common.services.ConnectorService; import org.apache.syncope.common.services.EntitlementService; @@ -33,6 +34,7 @@ import org.apache.syncope.common.to.AbstractTaskTO; import org.apache.syncope.common.to.UserTO; import org.apache.syncope.common.types.AttributableType; +import org.apache.syncope.common.types.RESTHeaders; import org.apache.syncope.common.types.SchemaType; public class App { @@ -211,6 +213,19 @@ private static UserTO createUser(final UserTO userTO) { return response.readEntity(UserTO.class); } + private static UserTO readUser(final String username) { + return userService.read(Long.valueOf( + userService.getUserId(username).getHeaderString(RESTHeaders.USER_ID.toString()))); + } + + private static UserTO updateUser(final UserMod userMod) { + return userService.update(userMod.getId(), userMod).readEntity(UserTO.class); + } + + private static UserTO deleteUser(final Long id) { + return userService.delete(id).readEntity(UserTO.class); + } + private static RoleTO createRole(final RoleTO roleTO) { final Response response = client.getService(RoleService.class).create(roleTO); if (response.getStatus() != Response.Status.CREATED.getStatusCode()) {