use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.
the class SchoolDataSourceDAO method create.
public SchoolDataSource create(String identifier) {
SchoolDataSource dataSource = new SchoolDataSource();
dataSource.setIdentifier(identifier);
getEntityManager().persist(dataSource);
return dataSource;
}
use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.
the class ForgotPasswordRESTService method confirmResetPassword.
@Path("/confirm")
@GET
@RESTPermitUnimplemented
public Response confirmResetPassword(ConfirmResetPassword crp) {
UserPendingPasswordChange passwordChange = userPendingPasswordChangeDAO.findByConfirmationHash(crp.getResetCode());
UserEntity userEntity = userEntityController.findUserEntityById(passwordChange.getUserEntity());
// TODO: tis a guesstimate of the datasource
SchoolDataSource schoolDataSource = userEntity.getDefaultSchoolDataSource();
try {
userSchoolDataController.confirmResetPassword(schoolDataSource, crp.getResetCode(), crp.getNewPassword());
return Response.noContent().build();
} catch (SchoolDataBridgeUnauthorizedException e) {
return Response.status(Status.FORBIDDEN).build();
}
}
use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.
the class UserSchoolDataController method findUserEntity.
/* User Entity */
public UserEntity findUserEntity(User user) {
SchoolDataSource schoolDataSource = schoolDataSourceDAO.findByIdentifier(user.getSchoolDataSource());
UserSchoolDataIdentifier userSchoolDataIdentifier = userSchoolDataIdentifierDAO.findByDataSourceAndIdentifierAndArchived(schoolDataSource, user.getIdentifier(), Boolean.FALSE);
return userSchoolDataIdentifier == null ? null : userSchoolDataIdentifier.getUserEntity();
}
use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.
the class UserSchoolDataController method updateUserCredentials.
public void updateUserCredentials(User user, String oldPassword, String newUsername, String newPassword) throws SchoolDataBridgeUnauthorizedException {
SchoolDataSource schoolDataSource = schoolDataSourceDAO.findByIdentifier(user.getSchoolDataSource());
if (schoolDataSource == null) {
throw new SchoolDataBridgeInternalException(String.format("Invalid data source %s", user.getSchoolDataSource()));
}
getUserBridge(schoolDataSource).updateUserCredentials(user.getIdentifier(), oldPassword, newUsername, newPassword);
}
use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.
the class WorkspaceEntityController method createWorkspaceEntity.
public WorkspaceEntity createWorkspaceEntity(String dataSource, String identifier, String urlName) {
SchoolDataSource schoolDataSource = schoolDataSourceDAO.findByIdentifier(dataSource);
if (schoolDataSource == null) {
logger.severe("Could not find school data source: " + dataSource);
return null;
}
WorkspaceEntity workspaceEntity = workspaceEntityDAO.create(schoolDataSource, identifier, urlName, WorkspaceAccess.LOGGED_IN, Boolean.FALSE, Boolean.FALSE);
return workspaceEntity;
}
Aggregations