use of org.olat.course.assessment.model.TransientAssessmentMode in project OpenOLAT by OpenOLAT.
the class AssessmentModeCoordinationServiceImpl method sendEvent.
private void sendEvent(String cmd, AssessmentMode mode, Set<Long> assessedIdentityKeys) {
TransientAssessmentMode transientMode = new TransientAssessmentMode(mode);
AssessmentModeNotificationEvent event = new AssessmentModeNotificationEvent(cmd, transientMode, assessedIdentityKeys);
coordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(event, AssessmentModeNotificationEvent.ASSESSMENT_MODE_NOTIFICATION);
}
use of org.olat.course.assessment.model.TransientAssessmentMode in project OpenOLAT by OpenOLAT.
the class AssessmentModeGuardController method syncAssessmentModes.
private void syncAssessmentModes(UserRequest ureq) {
List<ResourceGuard> modeWrappers = new ArrayList<ResourceGuard>();
for (TransientAssessmentMode mode : modes) {
if (mode != null) {
ResourceGuard wrapper = syncAssessmentMode(ureq, mode);
if (wrapper != null) {
modeWrappers.add(wrapper);
}
}
}
guards.setList(modeWrappers);
mainContinueButton.setVisible(modeWrappers.isEmpty());
mainVC.setDirty(true);
}
use of org.olat.course.assessment.model.TransientAssessmentMode in project OpenOLAT by OpenOLAT.
the class AssessmentModeListController method event.
@Override
public void event(Event event) {
if (event instanceof AssessmentModeNotificationEvent) {
AssessmentModeNotificationEvent amne = (AssessmentModeNotificationEvent) event;
TransientAssessmentMode mode = amne.getAssessementMode();
if (mode.getRepositoryEntryKey().equals(entry.getKey()) && model.updateModeStatus(amne.getAssessementMode())) {
tableEl.getComponent().setDirty(true);
}
}
}
use of org.olat.course.assessment.model.TransientAssessmentMode in project OpenOLAT by OpenOLAT.
the class AuthHelper method initializeLogin.
/**
* ONLY for authentication provider OLAT Authenticate Identity and do the
* necessary work. Returns true if successfull, false otherwise.
*
* @param identity
* @param authProvider
* @param ureq
* @return boolean
*/
private static int initializeLogin(Identity identity, String authProvider, UserRequest ureq, boolean rest) {
// continue only if user has login permission.
if (identity == null)
return LOGIN_FAILED;
// test if a user may not logon, since he/she is in the PERMISSION_LOGON
if (!BaseSecurityManager.getInstance().isIdentityVisible(identity)) {
log.audit("was denied login");
return LOGIN_DENIED;
}
UserSessionManager sessionManager = CoreSpringFactory.getImpl(UserSessionManager.class);
// if the user sending the cookie did not log out and we are logging in
// again, then we need to make sure everything is cleaned up. we cleanup in all cases.
UserSession usess = ureq.getUserSession();
// prepare for a new user: clear all the instance vars of the userSession
// note: does not invalidate the session, since it is reused
sessionManager.signOffAndClear(usess);
// init the UserSession for the new User
// we can set the identity and finish the log in process
usess.setIdentity(identity);
setRolesFor(identity, usess);
// check if loginDenied or maxSession (only for non-admin)
if ((loginBlocked && !usess.getRoles().isOLATAdmin()) || (((maxSessions != MAX_SESSION_NO_LIMIT) && (sessionManager.getUserSessionsCnt() >= maxSessions)) && !usess.getRoles().isOLATAdmin())) {
log.audit("Login was blocked for username=" + usess.getIdentity().getName() + ", loginBlocked=" + loginBlocked + " NbrOfSessions=" + sessionManager.getUserSessionsCnt());
sessionManager.signOffAndClear(usess);
return LOGIN_NOTAVAILABLE;
}
// need to block the all things for assessment?
if (usess.getRoles() != null && usess.getRoles().isOLATAdmin()) {
usess.setAssessmentModes(Collections.<TransientAssessmentMode>emptyList());
} else {
AssessmentModule assessmentModule = CoreSpringFactory.getImpl(AssessmentModule.class);
if (assessmentModule.isAssessmentModeEnabled()) {
AssessmentModeManager assessmentManager = CoreSpringFactory.getImpl(AssessmentModeManager.class);
List<AssessmentMode> modes = assessmentManager.getAssessmentModeFor(identity);
if (modes.isEmpty()) {
usess.setAssessmentModes(Collections.<TransientAssessmentMode>emptyList());
} else {
usess.setAssessmentModes(TransientAssessmentMode.create(modes));
}
}
}
// set the language
usess.setLocale(I18nManager.getInstance().getLocaleOrDefault(identity.getUser().getPreferences().getLanguage()));
// update fontsize in users session globalsettings
Windows.getWindows(ureq).getWindowManager().setFontSize(Integer.parseInt(identity.getUser().getPreferences().getFontsize()));
// calculate session info and attach it to the user session
setSessionInfoFor(identity, authProvider, ureq, rest);
// confirm signedOn
sessionManager.signOn(usess);
// set users web delivery mode
Windows.getWindows(ureq).getWindowManager().setAjaxWanted(ureq);
// update web delivery mode in session info
usess.getSessionInfo().setWebModeFromUreq(ureq);
return LOGIN_OK;
}
use of org.olat.course.assessment.model.TransientAssessmentMode in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method checkAssessmentGuard.
private boolean checkAssessmentGuard(UserRequest ureq, TransientAssessmentMode mode) {
boolean needUpdate;
if (assessmentGuardCtrl == null) {
if (lockStatus == LockStatus.need) {
List<TransientAssessmentMode> modes = mode == null ? Collections.<TransientAssessmentMode>emptyList() : Collections.singletonList(mode);
assessmentGuardCtrl = new AssessmentModeGuardController(ureq, getWindowControl(), modes, true);
listenTo(assessmentGuardCtrl);
assessmentGuardCtrl.getInitialComponent();
lockStatus = LockStatus.popup;
lockGUI();
needUpdate = true;
} else {
needUpdate = false;
}
} else {
needUpdate = assessmentGuardCtrl.updateAssessmentMode(ureq);
}
return needUpdate;
}
Aggregations