inveniosoftware / invenio

Invenio digital library framework
https://invenio.readthedocs.io
MIT License
626 stars 292 forks source link

WebAccess: Become user feature does not work #1424

Closed lnielsen closed 10 years ago

lnielsen commented 10 years ago

Originally on 2013-03-22

Stack trace from ZENODO


Hello:

It is the first time this exception has been seen.

- 2013-03-11 16:05:27 -> SERVER_RETURN: <BaseResponse 259 bytes [302 FOUND]> (urlutils.py:138:redirect_to_url)

-* User details
                         EXTERNAL_fullname: Natalia P. Manola
                               EXTERNAL_id: 207
                                     agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.160 Safari/537.22
                                     email: natalia@ath.forthnet.gr
                                     group: []
                                     guest: 0
                                        id: 13
                                  language: en
                              login_method: Local
                                  nickname: mnatalia
                                      note: 1
            precached_canseehiddenmarctags: False
precached_permitted_restricted_collections: []
                    precached_sendcomments: False
                        precached_useadmin: False
                       precached_usealerts: True
                      precached_useapprove: False
                      precached_usebaskets: True
                       precached_usegroups: True
                        precached_useloans: True
                     precached_usemessages: True
             precached_usepaperattribution: True
                   precached_usepaperclaim: True
                        precached_usestats: False
                   precached_viewclaimlink: False
                 precached_viewsubmissions: False
                                   referer: <https://zenodo-dev.cern.ch/admin/webaccess/webaccessadmin.py/modifyaccounts>
                               remote_host: 
                                 remote_ip: 137.138.36.206
                                   session: None
                                  settings: {'EXTERNAL_fullname': 'Natalia P. Manola', 'EXTERNAL_id': '207', 'login_method': 'Local', 'language': 'en'}
                                       uid: 13
                                       uri: </admin/webaccess/webaccessadmin.py/becomeuser>

-* Traceback details 

Traceback (most recent call last):
  File "/opt/zenodo/lib/python2.6/site-packages/invenio/webinterface_handler_flask.py", line 161, in __call__
    response = self.app.full_dispatch_request()
  File "/opt/zenodo/lib/python2.6/site-packages/flask/app.py", line 1360, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/zenodo/lib/python2.6/site-packages/flask/app.py", line 1358, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/zenodo/lib/python2.6/site-packages/flask/app.py", line 1344, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/zenodo/lib/python2.6/site-packages/invenio/webinterface_handler_flask.py", line 201, in static_handler_with_legacy_publisher
    mp_legacy_publisher(req, possible_module, possible_handler)
  File "/opt/zenodo/lib/python2.6/site-packages/invenio/webinterface_handler_wsgi.py", line 604, in mp_legacy_publisher
    return _check_result(req, module_globals[possible_handler](req, **cleaned_form))
  File "<string>", line 123, in becomeuser
  File "/opt/zenodo/lib/python2.6/site-packages/invenio/webaccessadmin_lib.py", line 1129, in perform_becomeuser
    redirect_to_url(req, CFG_SITE_SECURE_URL)
  File "/opt/zenodo/lib/python2.6/site-packages/invenio/urlutils.py", line 138, in redirect_to_url
    raise apache.SERVER_RETURN, r
SERVER_RETURN: <BaseResponse 259 bytes [302 FOUND]>

-* Stack frame details

Frame redirect_to_url in /opt/zenodo/lib/python2.6/site-packages/invenio/urlutils.py at line 138
-------------------------------------------------------------------------------
       135 
       136     from flask import redirect
       137     r = redirect(url, code=redirection_type)
---->  138     raise apache.SERVER_RETURN, r
       139     #FIXME enable code bellow
       140 
       141     del req.headers_out["Cache-Control"]
-------------------------------------------------------------------------------
                redirect =  '<function redirect at 0x7feb17b0a050>'
                 norobot =  'False'
                     url =  "'https://zenodo-dev.cern.ch'"
        redirection_type =  '302'
                     req =  '<invenio.webinterface_handler_wsgi.SimulatedModPythonRequest object at 0x7feafc328910>'
                       r =  '<BaseResponse 259 bytes [302 FOUND]>'

Frame perform_becomeuser in /opt/zenodo/lib/python2.6/site-packages/invenio/webaccessadmin_lib.py at line 1129
-------------------------------------------------------------------------------
      1126     output = ""
      1127     if res:
      1128         update_Uid(req, res[0][0])
----> 1129         redirect_to_url(req, CFG_SITE_SECURE_URL)
      1130     else:
      1131         output += '<b><span class="info">The account id given does not exist.</span></b>'
      1132 
-------------------------------------------------------------------------------
                subtitle =  '\'<a name="5"></a>5. Became user.&nbsp;&nbsp;&nbsp;<small>[<a title="See guide" href="https://zenodo-dev.cern.ch/help/admin/webaccess-admin-guide#5">?</a>]</small>\''
                 confirm =  '0'
                     res =  "(('natalia@ath.forthnet.gr',),)"
                     req =  '<invenio.webinterface_handler_wsgi.SimulatedModPythonRequest object at 0x7feafc328910>'
                  userID =  "u'13'"
                callback =  "'yes'"
            auth_message =  "'Authorization granted'"
               auth_code =  '0'
                  output =  "''"

Frame becomeuser in <string> at line 123
                      ln =  "'en'"
                callback =  "'yes'"
                     req =  '<invenio.webinterface_handler_wsgi.SimulatedModPythonRequest object at 0x7feafc328910>'
                  userID =  "u'13'"
                 confirm =  '0'

Frame mp_legacy_publisher in /opt/zenodo/lib/python2.6/site-packages/invenio/webinterface_handler_wsgi.py at line 604
-------------------------------------------------------------------------------
       601                         cleaned_form[arg] = form.get(arg, expected_defaults[index])
       602                     else:
       603                         cleaned_form[arg] = form.get(arg, None)
---->  604                 return _check_result(req, module_globals[possible_handler](req, **cleaned_form))
       605             else:
       606                 raise
       607     else:
-------------------------------------------------------------------------------
                   index =  '4'
          CFG_FULL_HTTPS =  'False'
          inspected_args =  "ArgSpec(args=['req', 'userID', 'callback', 'confirm', 'ln'], varargs=None, keywords=None, defaults=('', 'yes', 0, 'en'))"
       expected_defaults =  "['en', 0, 'yes', '']"
                     err =  'TypeError("becomeuser() got an unexpected keyword argument \'maxpage\'",)'
                    form =  '{\'maxpage\': u\'25\', \'limit_to\': u\'all\', \'userID\': u\'13\', \'page\': u\'1"\', \'email_user_pattern\': u\'natali\'}'
              the_module =  '\'## This file is part of Invenio.\\n## Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.\\n##\\n## Invenio is free software; you can redistribute it and/or\\n## modify it under the terms of the GNU General Public License as\\n## published by the Free Software Foundation; either version 2 of the\\n## License, or (at your option) any later version.\\n##\\n## Invenio is distributed in the hope that it will be useful, but\\n## WITHOUT ANY WARRANTY; without even the implied w [...]
            cleaned_form =  "{'ln': 'en', 'callback': 'yes', 'userID': u'13', 'confirm': 0}"
                     req =  '<invenio.webinterface_handler_wsgi.SimulatedModPythonRequest object at 0x7feafc328910>'
                 request =  "<InvenioRequest 'https://zenodo-dev.cern.ch/admin/webaccess/webaccessadmin.py/becomeuser?userID=13&email_user_pattern=natali&limit_to=all&maxpage=25&page=1%22' [GET]>"
             get_session =  '<function get_session at 0x7feb1900d230>'
                   value =  "u'natali'"
           expected_args =  "['ln', 'confirm', 'callback', 'userID', 'req']"
          module_globals =  '{\'editaccount\': <function editaccount at 0x7feafd4cc6e0>, \'modifyauthorizations\': <function modifyauthorizations at 0x7feafd4ccf50>, \'delegate_deleteuserrole\': <function delegate_deleteuserrole at 0x7feafd4cc9b0>, \'addauthorization\': <function addauthorization at 0x7feafd4cce60>, \'modifylogindata\': <function modifylogindata at 0x7feafd4cc500>, \'simpleauthorization\': <function simpleauthorization at 0x7feafd4cd0c8>, \'userarea\': <function userarea at 0x7feafd4cc0c8>, \'becomeuser\': [...]
        possible_handler =  "'becomeuser'"
           _check_result =  '<function _check_result at 0x7feb19010398>'
                     key =  "'email_user_pattern'"
         possible_module =  "'/opt/zenodo/var/www/admin/webaccess/webaccessadmin.py'"
    CFG_HAS_HTTPS_SUPPORT =  'True'
                     arg =  "'req'"

Frame static_handler_with_legacy_publisher in /opt/zenodo/lib/python2.6/site-packages/invenio/webinterface_handler_flask.py at line 201
-------------------------------------------------------------------------------
       198                                                 request.environ['PATH_INFO'])
       199         if possible_module is not None:
       200             req = SimulatedModPythonRequest(request.environ, g.start_response)
---->  201             mp_legacy_publisher(req, possible_module, possible_handler)
       202             return req.response
       203 
       204         # Static file serving for devserver
-------------------------------------------------------------------------------
     mp_legacy_publisher =  '<function mp_legacy_publisher at 0x7feb18b0b758>'
                    args =  '()'
    SimulatedModPythonRequest =  "<class 'invenio.webinterface_handler_wsgi.SimulatedModPythonRequest'>"
                     req =  '<invenio.webinterface_handler_wsgi.SimulatedModPythonRequest object at 0x7feafc328910>'
        possible_handler =  "'becomeuser'"
                  kwargs =  "{'filename': u'admin/webaccess/webaccessadmin.py/becomeuser'}"
                    _app =  '<flask.app.Flask object at 0x7feb18526c50>'
    is_mp_legacy_publisher_path =  '<function is_mp_legacy_publisher_path at 0x7feb18b0b6e0>'
         possible_module =  "'/opt/zenodo/var/www/admin/webaccess/webaccessadmin.py'"

Frame dispatch_request in /opt/zenodo/lib/python2.6/site-packages/flask/app.py at line 1344
-------------------------------------------------------------------------------
      1341            and req.method == 'OPTIONS':
      1342             return self.make_default_options_response()
      1343         # otherwise dispatch to the handler for that endpoint
----> 1344         return self.view_functions[rule.endpoint](**req.view_args)
      1345 
      1346     def full_dispatch_request(self):
      1347         """Dispatches the request and on top of that performs request
-------------------------------------------------------------------------------
                    self =  '<flask.app.Flask object at 0x7feb18526c50>'
                     req =  "<InvenioRequest 'https://zenodo-dev.cern.ch/admin/webaccess/webaccessadmin.py/becomeuser?userID=13&email_user_pattern=natali&limit_to=all&maxpage=25&page=1%22' [GET]>"
                    rule =  "<Rule '/<filename>' (HEAD, OPTIONS, GET) -> static>"

Frame full_dispatch_request in /opt/zenodo/lib/python2.6/site-packages/flask/app.py at line 1360
-------------------------------------------------------------------------------
      1357             if rv is None:
      1358                 rv = self.dispatch_request()
      1359         except Exception, e:
----> 1360             rv = self.handle_user_exception(e)
      1361         response = self.make_response(rv)
      1362         response = self.process_response(response)
      1363         request_finished.send(self, response=response)
-------------------------------------------------------------------------------
                      rv =  'None'
                       e =  'SERVER_RETURN(<BaseResponse 259 bytes [302 FOUND]>,)'
                    self =  '<flask.app.Flask object at 0x7feb18526c50>'

Frame full_dispatch_request in /opt/zenodo/lib/python2.6/site-packages/flask/app.py at line 1360
-------------------------------------------------------------------------------
      1357             if rv is None:
      1358                 rv = self.dispatch_request()
      1359         except Exception, e:
----> 1360             rv = self.handle_user_exception(e)
      1361         response = self.make_response(rv)
      1362         response = self.process_response(response)
      1363         request_finished.send(self, response=response)
-------------------------------------------------------------------------------
                      rv =  'None'
                       e =  'SERVER_RETURN(<BaseResponse 259 bytes [302 FOUND]>,)'
                    self =  '<flask.app.Flask object at 0x7feb18526c50>'

Frame __call__ in /opt/zenodo/lib/python2.6/site-packages/invenio/webinterface_handler_flask.py at line 163
-------------------------------------------------------------------------------
       160                 try:
       161                     response = self.app.full_dispatch_request()
       162                 except Exception as e:
---->  163                     register_exception(req=request, alert_admin=True)
       164                     response = self.app.handle_exception(e)
       165 
       166                 return response(environ, start_response)
-------------------------------------------------------------------------------
          start_response =  '<built-in method start_response of mod_wsgi.Adapter object at 0x7feafc324120>'
                 environ =  "{'mod_wsgi.listener_port': '443', 'HTTP_COOKIE': '__utma=203412483.619949981.1355238049.1355238049.1355238049.1; __utmz=203412483.1355238049.1.1.utmcsr=wlcg.web.cern.ch|utmccn=(referral)|utmcmd=referral|utmcct=/; km_ai=HrYfD5M9%2FSrBbb0kPLFc%2FCBjfY4%3D; km_lv=1355924771; km_uq=; _pk_id.2.7c24=a5a41e1836933031.1360753557.7.1361810040.1361374488.; _pk_id.57.7c24=53818b86523ba0b5.1362661243.3.1362671880.1362669855.; __atuvc=58%7C10; INVENIOSESSION=e2efd8b048074390ab51016782e201cf; INVENIOSESSIONs [...]
                    self =  '<invenio.webinterface_handler_flask.LegacyAppMiddleware object at 0x7feb18b0c050>'
                       e =  'SERVER_RETURN(<BaseResponse 259 bytes [302 FOUND]>,)'

Best regards
--
ZENODO <http://zenodo-dev.cern.ch>
Need human intervention?  Contact <OpenAIRE-Support@cern.ch>
jirikuncar commented 10 years ago

Originally on 2013-03-25

You can find the fix here 1424-fix-become-user-feature.

jirikuncar commented 10 years ago

Originally on 2013-04-03

In eb49779b0b7be97e6c71c5f58d1bfe8bc5bbc1ba:

#CommitTicketReference repository="invenio" revision="eb49779b0b7be97e6c71c5f58d1bfe8bc5bbc1ba"
WebSession: fix typo in setUid

- Fixes become user feature.  (closes #1424)

Reported-by: Lars Holm Nielsen <lars.holm.nielsen@cern.ch>