Bonita应用下 添加用户

在Bonita应用程序下( TOMCAT_HOME/webapps/bonita目录下),程序添加用户,

 

try {


//测试,所以admin ,bpm用hardcode,真实环境使用

// HttpServletRequest arequst

// HttpSession theSession = aRequest.getSession();

//UserProfile theUserProfile = (UserProfile) theSession.getAttribute(USER_PROFILE_SESSION_PARAM_KEY);

//

org.ow2.bonita.util.SimpleCallbackHandler handler = new org.ow2.bonita.util.SimpleCallbackHandler("admin", "bpm");


 javax.security.auth.login.LoginContext loginContext= new javax.security.auth.login.LoginContext("BonitaStore", handler);
 loginContext.login();
 org.bonitasoft.console.client.identity.User user = new  org.bonitasoft.console.client.identity.User();
 user.setUsername("moliqin");
 user.setPassword("moliqin");
 user.setFirstName("first");
 org.bonitasoft.console.client.users.UserFilter aFilter = new org.bonitasoft.console.client.users.UserFilter(0,20);
 org.bonitasoft.console.server.identity.IdentityDataStore.getInstance().addUser(user, aFilter);
}catch(Exception e){
    e.printStackTrace();
}

 

 

 

你可能感兴趣的:(Bonita应用下 添加用户)