Example #1
0
 def setupSession(self):
     """Setup the session for the context survey. This will rebuild the
     session tree if the profile has changed.
     """
     survey = aq_inner(self.context)
     new_profile = self.getDesiredProfile()
     self.session = set_session_profile(survey, self.session, new_profile)
     SessionManager.resume(self.session)
Example #2
0
 def setupSession(self):
     """Setup the session for the context survey. This will rebuild the
     session tree if the profile has changed.
     """
     survey = aq_inner(self.context)
     new_profile = self.getDesiredProfile()
     self.session = set_session_profile(survey, self.session, new_profile)
     SessionManager.resume(self.session)
Example #3
0
 def _start(self, link):
     pas = getToolByName(self.context, 'acl_users')
     pas.updateCredentials(self.request, self.response,
             link.session.account.loginname, None)
     newSecurityManager(None, link.session.account)
     SessionManager.resume(link.session)
     survey = self.request.client.restrictedTraverse(str(link.session.zodb_path))
     v_url = urlparse.urlsplit(self.url() + '/od-resume').path
     trigger_extra_pageview(self.request, v_url)
     self.request.response.redirect("%s/resume" % survey.absolute_url())
Example #4
0
 def _ContinueSurvey(self, info):
     """Utility method to continue an existing session."""
     session = Session.query(model.SurveySession).get(info["session"])
     current_user = aq_base(getSecurityManager().getUser())
     if session.account is not current_user:
         log.warn('User %s tried to hijack session from %s',
                 getattr(current_user, 'loginname', repr(current_user)),
                 session.account.loginname)
         raise Unauthorized()
     SessionManager.resume(session)
     survey = self.request.client.restrictedTraverse(str(session.zodb_path))
     v_url = urlparse.urlsplit(self.url()+'/resume').path
     trigger_extra_pageview(self.request, v_url)
     self.request.response.redirect("%s/resume" % survey.absolute_url())
Example #5
0
 def _ContinueSurvey(self, info):
     """Utility method to continue an existing session."""
     session = Session.query(model.SurveySession).get(info["session"])
     current_user = aq_base(getSecurityManager().getUser())
     if session.account is not current_user:
         log.warn('User %s tried to hijack session from %s',
                  getattr(current_user, 'loginname', repr(current_user)),
                  session.account.loginname)
         raise Unauthorized()
     SessionManager.resume(session)
     survey = self.request.client.restrictedTraverse(str(session.zodb_path))
     v_url = urlparse.urlsplit(self.url() + '/resume').path
     trigger_extra_pageview(self.request, v_url)
     self.request.response.redirect("%s/resume?initial_view=1" %
                                    survey.absolute_url())
Example #6
0
    def _continue(self, session_id, vestigings_sleutel, webservice):
        session = Session.query(model.SurveySession).get(session_id)
        account = aq_base(getSecurityManager().getUser())
        if session.account is not account:
            log.warn('User %s tried to hijack session from %s',
                    getattr(account, 'loginname', repr(account)),
                    session.account.loginname)
            raise Unauthorized()

        Session.add(OdLink(
            session=session,
            vestigings_sleutel=vestigings_sleutel,
            webservice=webservice))

        SessionManager.resume(session)
        survey = self.request.client.restrictedTraverse(str(session.zodb_path))
        v_url = urlparse.urlsplit(self.url() + '/od-link').path
        trigger_extra_pageview(self.request, v_url)
        self.request.response.redirect("%s/resume" % survey.absolute_url())
Example #7
0
    def hasValidSession(self, request):
        """Check if the user has an active session for the survey.
        """
        dbsession = SessionManager.session
        client_path = utils.RelativePath(request.client, self.context)

        if dbsession is None or \
                dbsession.zodb_path != client_path:

            # Allow for alternative session ids to be hardcoded in the
            # euphorie.ini file for automatic browser testing with Browsera
            conf = getUtility(IAppConfig).get("euphorie", {})
            debug_ids = conf.get('debug_sessions', '').strip().splitlines()
            for sid in debug_ids:
                session = Session.query(model.SurveySession).get(sid)
                if hasattr(session, 'zodb_path') and \
                        session.zodb_path == client_path:
                    SessionManager.resume(session)
                    return True

            return False
        return True
Example #8
0
    def hasValidSession(self, request):
        """Check if the user has an active session for the survey.
        """
        dbsession = SessionManager.session
        client_path = utils.RelativePath(request.client, self.context)

        if dbsession is None or \
                dbsession.zodb_path != client_path:

            # Allow for alternative session ids to be hardcoded in the
            # euphorie.ini file for automatic browser testing with Browsera
            conf = getUtility(IAppConfig).get("euphorie", {})
            debug_ids = conf.get('debug_sessions', '').strip().splitlines()
            for sid in debug_ids:
                session = Session.query(model.SurveySession).get(sid)
                if hasattr(session, 'zodb_path') and \
                        session.zodb_path == client_path:
                    SessionManager.resume(session)
                    return True

            return False
        return True
Example #9
0
 def _ContinueSurvey(self, info):
     """Utility method to continue an existing session."""
     session = Session.query(model.SurveySession).get(info["session"])
     SessionManager.resume(session)
     survey = self.request.client.restrictedTraverse(str(session.zodb_path))
     self.request.response.redirect("%s/resume" % survey.absolute_url())