Esempio n. 1
0
File: adif.py Progetto: LANJr4D/FRED
 def _authenticate(self, form, admin):
     login = form.cleaned_data.get('login', '')
     password = form.cleaned_data.get('password', '')
     logger = utils.get_logger()
     try:
         auth.authenticate_user(admin, login, password)
         try:
             logger_session_id = logger.start_session(0, login)
             cherrypy.session['logger_session_id'] = logger_session_id
         except (omniORB.CORBA.SystemException,
                 ccReg.Admin.ServiceUnavailable):
             if config.audit_log['force_critical_logging']:
                 raise
     except AuthenticationError:
         cherrypy.response.status = 403
         raise
Esempio n. 2
0
 def _authenticate(self, form, admin):
     login = form.cleaned_data.get('login', '')
     password = form.cleaned_data.get('password', '')
     logger = utils.get_logger()
     try:
         auth.authenticate_user(admin, login, password)
         try:
             logger_session_id = logger.start_session(0, login)
             cherrypy.session['logger_session_id'] = logger_session_id
         except (omniORB.CORBA.SystemException,
                 ccReg.Admin.ServiceUnavailable):
             if config.audit_log['force_critical_logging']:
                 raise
     except AuthenticationError:
         cherrypy.response.status = 403
         raise
Esempio n. 3
0
File: adif.py Progetto: LANJr4D/FRED
    def _init_login(self, form):
        corba_server_spec = int(form.cleaned_data.get('corba_server', 0))
        cherrypy.session['corba_server'] = corba_server_spec # couple [oir, context]
        cherrypy.session['filterforms'] = copy(filterforms.form_classes)
        self._corba_connect(corba_server_spec)

        admin = corba_obj.getObject('Admin', 'ccReg.Admin')
        cherrypy.session['Admin'] = admin

        logger = utils.get_logger()
        if getattr(logger, 'dao', None):
            cherrypy.session['Logger'] = logger.dao # needed by CorbaLazyRequest
        if isinstance(logger, DummyLogger):
            logger_form = filterforms.LoggerFilterForm
            if logger_form in cherrypy.session['filterforms']:
                # Remove LoggerFilterForm from filterforms to prevent
                # exceptions during filterform-related javascript 
                # generation.
                cherrypy.session['filterforms'].remove(logger_form)
        return admin
Esempio n. 4
0
    def _init_login(self, form):
        corba_server_spec = int(form.cleaned_data.get('corba_server', 0))
        cherrypy.session['corba_server'] = corba_server_spec  # couple [oir, context]
        cherrypy.session['filterforms'] = copy(filterforms.form_classes)
        self._corba_connect(corba_server_spec)

        admin = corba_obj.getObject('Admin', 'ccReg.Admin')
        cherrypy.session['Admin'] = admin

        logger = utils.get_logger()
        if getattr(logger, 'dao', None):
            cherrypy.session['Logger'] = logger.dao  # needed by CorbaLazyRequest
        if isinstance(logger, DummyLogger):
            logger_form = filterforms.LoggerFilterForm
            if logger_form in cherrypy.session['filterforms']:
                # Remove LoggerFilterForm from filterforms to prevent
                # exceptions during filterform-related javascript
                # generation.
                cherrypy.session['filterforms'].remove(logger_form)
        return admin
Esempio n. 5
0
File: adif.py Progetto: LANJr4D/FRED
    @login_required
    def logout(self):
        if cherrypy.session.get('Admin'):
            try:
                corba_session_string = cherrypy.session['corbaSessionString']
                cherrypy.session['Admin'].destroySession(
                    corba_session_string)
            except CORBA.TRANSIENT, e:
                debug('Admin.destroySession call failed, backend server '
                      'is not running.\n%s' % e)
        if cherrypy.session.get('Logger'):
            try:
                log_req = utils.create_log_request('Logout')
                log_req.result = 'Success'
                log_req.close()
                utils.get_logger().close_session(session_id=cherrypy.session.get('logger_session_id'))
            except (omniORB.CORBA.SystemException,
                ccReg.Admin.ServiceUnavailable,
                LoggingException):
                # Let the user logout even when logging is critical (otherwise
                # they're stuck in Daphne and they have to manually delete the
                # session).
                error("Failed to log logout action!")
        self._remove_session_data()
        raise cherrypy.HTTPRedirect('/')


class Summary(AdifPage):
    def _template(self, action=''):
        if action == 'summary':
            return BaseSiteMenu
Esempio n. 6
0
    @login_required
    def logout(self):
        if cherrypy.session.get('Admin'):
            try:
                corba_session_string = cherrypy.session['corbaSessionString']
                cherrypy.session['Admin'].destroySession(corba_session_string)
            except CORBA.TRANSIENT, e:
                debug('Admin.destroySession call failed, backend server '
                      'is not running.\n%s' % e)
        if cherrypy.session.get('Logger'):
            try:
                log_req = utils.create_log_request('Logout')
                log_req.result = 'Success'
                log_req.close()
                utils.get_logger().close_session(
                    session_id=cherrypy.session.get('logger_session_id'))
            except (omniORB.CORBA.SystemException,
                    ccReg.Admin.ServiceUnavailable, LoggingException):
                # Let the user logout even when logging is critical (otherwise
                # they're stuck in Daphne and they have to manually delete the
                # session).
                error("Failed to log logout action!")
        self._remove_session_data()
        raise cherrypy.HTTPRedirect('/')


class Summary(AdifPage):
    def _template(self, action=''):
        if action == 'summary':
            return BaseSiteMenu
        else: