Pages

Showing posts with label Lock User API. Show all posts
Showing posts with label Lock User API. Show all posts

Thursday, December 20, 2012

UserManager : Misc (Lock/Unlock/Disable/Enable)

Now lets look at the other important functionalities provided by the UserManager class.

1) Code

public void misc(OIMClient oimclient){
UserManager usrMgr = oimclient.getService(UserManager.class);
try {
usrMgr.lock("65", true, true);
usrMgr.unlock("65", false);
usrMgr.disable("65", false);
usrMgr.enable("65", false);
} catch (ValidationFailedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UserLockException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchUserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (AccessDeniedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UserUnlockException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UserDisableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UserEnableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

2) Result

User is locked/unlocked/disabled/enabled as expected

3) JavaDoc

You can find more information about the UserManager class and its methods in the javadoc link.