use of org.akaza.openclinica.domain.user.AuthoritiesBean in project OpenClinica by OpenClinica.
the class AccountController method buildUserAccount.
private UserAccountBean buildUserAccount(String studyOid, String studySubjectOid, String fName, String lName, String mobile, String accessCode, UserAccountBean ownerUserAccount, String pUserName, String email) throws Exception {
UserAccountBean createdUserAccountBean = new UserAccountBean();
createdUserAccountBean.setName(pUserName);
createdUserAccountBean.setFirstName(fName);
createdUserAccountBean.setLastName(lName);
createdUserAccountBean.setEmail(INPUT_EMAIL);
createdUserAccountBean.setInstitutionalAffiliation(INPUT_INSTITUTION);
createdUserAccountBean.setLastVisitDate(null);
createdUserAccountBean.setActiveStudyId(getStudy(studyOid).getId());
createdUserAccountBean.setPasswdTimestamp(null);
createdUserAccountBean.setPasswdChallengeQuestion("");
createdUserAccountBean.setPasswdChallengeAnswer("");
createdUserAccountBean.setOwner(ownerUserAccount);
createdUserAccountBean.setRunWebservices(false);
createdUserAccountBean.setPhone(mobile);
createdUserAccountBean.setAccessCode(accessCode);
createdUserAccountBean.setPasswd("5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8");
createdUserAccountBean.setEmail(email);
// Since 3.8, openclinica participate needs to be able to use api from openclinica using api_key
// Copied from UserAccountController.java
String apiKey = null;
do {
apiKey = getRandom32ChApiKey();
} while (isApiKeyExist(apiKey));
createdUserAccountBean.setEnableApiKey(true);
createdUserAccountBean.setApiKey(apiKey);
Role r = Role.RESEARCHASSISTANT2;
createdUserAccountBean = addActiveStudyRole(createdUserAccountBean, getStudy(studyOid).getId(), r, ownerUserAccount);
UserType type = UserType.get(2);
createdUserAccountBean.addUserType(type);
authoritiesDao = (AuthoritiesDao) SpringServletAccess.getApplicationContext(context).getBean("authoritiesDao");
authoritiesDao.saveOrUpdate(new AuthoritiesBean(createdUserAccountBean.getName()));
return createdUserAccountBean;
}
Aggregations