Adding client library sample for changing user status

Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/291c6d31
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/291c6d31
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/291c6d31

Branch: refs/heads/master
Commit: 291c6d31e18956b6ccb4ca24e6b389490ae71475
Parents: 336fe41
Author: Francesco Chicchiriccò <ilgro...@apache.org>
Authored: Thu Oct 6 15:39:41 2016 +0200
Committer: Francesco Chicchiriccò <ilgro...@apache.org>
Committed: Thu Oct 6 15:39:56 2016 +0200

----------------------------------------------------------------------
 .../workingwithapachesyncope/restfulservices.adoc | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/291c6d31/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc
----------------------------------------------------------------------
diff --git 
a/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc
 
b/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc
index 0380916..7adacd6 100644
--- 
a/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc
+++ 
b/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc
@@ -349,3 +349,21 @@ Map<String, Set<String>> realm2entitlements = 
self.getLeft(); // <2>
 <1> 
http://syncope.apache.org/apidocs/2.0/org/apache/syncope/common/lib/to/UserTO.html[UserTO^]
 of the requesting user
 <2> for each <<realms,realm>>, the owned <<entitlements,entitlements>>
 ====
+
+.Change user status
+====
+[source,java]
+----
+String key = ...; // <1>
+StatusPatch statusPatch = new StatusPatch();
+statusPatch.setKey(key);
+statusPatch.setType(StatusPatchType.SUSPEND); // <2>
+UserTO userTO = userService.status(statusPatch).
+  readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+  }).getEntity(); // <3>
+----
+<1> assume the key of the user to be suspended is known in advance
+<2> `ACTIVATE`, `SUSPEND`, `REACTIVATE` values are accepted, and honored 
depending on the actual status of the user
+being updated
+<3> request for user update and read back the updated entity
+====

Reply via email to