use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.
the class AccountController method auditcrc.
@RequestMapping(value = "/auditcrc", method = RequestMethod.POST)
public ResponseEntity<HashMap> auditcrc(@RequestBody HashMap<String, String> requestMap) throws Exception {
HashMap map = new HashMap();
String crcUserName = requestMap.get("crcUserName");
String studyOid = requestMap.get("studyOid");
String studySubjectId = requestMap.get("studySubjectId");
StudyBean parentStudy = getParentStudy(studyOid);
StudySubjectBean studySubjectBean = getStudySubject(studySubjectId, parentStudy);
// build UserName
HashMap<String, String> mapValues = buildParticipantUserName(studySubjectBean);
// Participant User Name
String pUserName = mapValues.get("pUserName");
AuditUserLoginBean auditUserLogin = new AuditUserLoginBean();
UserAccountBean userAccount = getUserAccount(crcUserName);
auditUserLogin.setUserName(userAccount.getName());
auditUserLogin.setLoginStatus(LoginStatus.ACCESS_CODE_VIEWED);
auditUserLogin.setLoginAttemptDate(new Date());
auditUserLogin.setUserAccountId(userAccount != null ? userAccount.getId() : null);
auditUserLogin.setDetails(pUserName);
getAuditUserLoginDao().save(auditUserLogin);
return new ResponseEntity<HashMap>(map, org.springframework.http.HttpStatus.OK);
}
use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.
the class AccountController method updateTimezone.
/**
* @api {post} /pages/accounts/timezone Update subject time zone
* @apiName updateTimezone
* @apiPermission admin
* @apiVersion 3.8.0
* @apiParam {String} studyOid Study Oid.
* @apiParam {String} studySubjectId Study Subject Oid .
* @apiParam {String} timeZone Time Zone .
* @apiGroup Subject
* @apiDescription Updates the subject time zone
* @apiParamExample {json} Request-Example:
* {
* "studyOid": "S_BL101",
* "studySubjectId": "SS_SUB100",
* "timeZone": "America/New_York"
* }
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* {
* }
*/
@RequestMapping(value = "/timezone", method = RequestMethod.POST)
public ResponseEntity<UserDTO> updateTimezone(@RequestBody HashMap<String, String> map) throws Exception {
uDTO = null;
StudyBean parentStudy = getParentStudy(map.get("studyOid"));
String oid = parentStudy.getOid();
String studySubjectId = map.get("studySubjectId");
String timeZone = map.get("timeZone");
ResourceBundleProvider.updateLocale(new Locale("en_US"));
UserAccountDAO udao = new UserAccountDAO(dataSource);
StudySubjectBean studySubjectBean = getStudySubjectByOidAndStudy(studySubjectId, parentStudy.getId());
HashMap<String, String> mapValues = buildParticipantUserName(studySubjectBean);
// Participant User Name
String pUserName = mapValues.get("pUserName");
udao = new UserAccountDAO(dataSource);
UserAccountBean userAccountBean = (UserAccountBean) udao.findByUserName(pUserName);
if (studySubjectBean.isActive()) {
studySubjectBean.setTime_zone(timeZone);
studySubjectBean.setUpdater(userAccountBean);
updateStudySubjectBean(studySubjectBean);
return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.OK);
}
return null;
}
use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.
the class AccountController method getStudy.
private StudyBean getStudy(String oid) {
StudyDAO sdao = new StudyDAO(dataSource);
StudyBean studyBean = (StudyBean) sdao.findByOid(oid);
return studyBean;
}
use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.
the class AccountController method getAccount1.
/**
* @api {get} /pages/accounts/study/:studyOid/crc/:crcUserName Retrieve a user account - crc
* @apiName getAccount1
* @apiPermission Module participate - enabled & admin
* @apiVersion 3.8.0
* @apiParam {String} studyOid Study Oid.
* @apiParam {String} crcUserName CRC Username .
* @apiGroup User Account
* @apiDescription Retrieves the crc user account with the given crcUserName and studyOid
* @apiParamExample {json} Request-Example:
* {
* "studyOid": " S_BL101",
* "crcUserName": "crc_user"
* }
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* {
* "lName": "Jackson",
* "mobile": "",
* "accessCode": "",
* "apiKey": "6e8b69f6fb774e899f9a6c349c5adace",
* "password": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
* "email": "abc@yahoo.com",
* "userName": "crc_user",
* "studySubjectId": null,
* "fName": "joe"
* }
*/
@RequestMapping(value = "/study/{studyOid}/crc/{crcUserName}", method = RequestMethod.GET)
public ResponseEntity<UserDTO> getAccount1(@PathVariable("studyOid") String studyOid, @PathVariable("crcUserName") String crcUserName) throws Exception {
ResourceBundleProvider.updateLocale(new Locale("en_US"));
UserAccountDAO udao = new UserAccountDAO(dataSource);
uDTO = null;
StudyBean parentStudy = getParentStudy(studyOid);
Integer pStudyId = parentStudy.getId();
String oid = parentStudy.getOid();
if (isStudyASiteLevelStudy(studyOid))
return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
if (!mayProceed(oid))
return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
if (isStudyDoesNotExist(oid))
return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
if (isCRCUserAccountDoesNotExist(crcUserName))
return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
if (doesCRCNotHaveStudyAccessRole(crcUserName, pStudyId))
return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
UserAccountBean userAccountBean = (UserAccountBean) udao.findByUserName(crcUserName);
buildUserDTO(userAccountBean);
return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.OK);
}
use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.
the class AccountController method isStudySubjecAndCRCRolesMatch.
private Boolean isStudySubjecAndCRCRolesMatch(String studySubjectId, String crcUserName, String studyOid) {
// crc is siteA studySubject is siteA , pass (same site)
// crc is siteA studySubject is siteB , Fail
// crc is siteA studySubject is study , Fail
// crc is study studySubject is siteA , pass
// crc is study studySubject is siteB , pass
// crc is study studySubject is study , pass
StudyBean parentStudy = getParentStudy(studyOid);
Integer studyIdFromStudyOid = parentStudy.getId();
StudySubjectBean studySubjectBean = getStudySubject(studySubjectId, parentStudy);
Integer studyIdFromStudySubjectId = studySubjectBean.getStudyId();
return doesStudySubjecAndCRCRolesMatch(crcUserName, studyIdFromStudySubjectId);
}
Aggregations