Property prop = new Property("samaccountname",this.createUser);
// Property prop2 = new Property("userAccountControl",66048);
propSet.put(prop);
// propSet.put(prop2);
User newUser = idStore.getUserManager()
.createUser(this.createUser,
this.createUserPassword.toCharArray(),
propSet);
if ( createUserRole != null ) {
SimpleSearchFilter filter =
idStore.getSimpleSearchFilter(RoleProfile.NAME,
SimpleSearchFilter.TYPE_EQUAL,
this.createUserRole);
SearchParameters sp = new SearchParameters(filter,
SearchParameters.SEARCH_ROLES_ONLY);
SearchResponse response = idStore.search(sp);
if (response.hasNext()) {
Role role = (Role)response.next();
idStore.getRoleManager().grantRole(role, newUser.getPrincipal());
}
}
ModProperty userAccountControl =
new ModProperty("userAccountControl",
"66048",
ModProperty.REPLACE );
newUser.getUserProfile().setProperty(userAccountControl);
FacesMessage fm = new FacesMessage("Success");
fm.setSeverity(FacesMessage.SEVERITY_INFO);
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, fm);