wcs: send an explicitely empty NameID to mark anonymous calls (#9102)

This commit is contained in:
Frédéric Péters 2015-11-24 13:41:37 +01:00
parent 8a4eb41869
commit 85f0906aaf
1 changed files with 4 additions and 1 deletions

View File

@ -164,7 +164,7 @@ class WcsBlurpMixin(object):
url += 'format=json'
if wcs_site.get('orig') and wcs_site.get('secret'):
url += '&orig=%s' % wcs_site['orig']
if context.get('user'):
if context.get('user') and context['user'].is_authenticated():
if context.get('request') and hasattr(context['request'], 'session') \
and context['request'].session.get('mellon_session'):
mellon = context['request'].session['mellon_session']
@ -172,6 +172,9 @@ class WcsBlurpMixin(object):
url += '&NameID=' + urllib.quote(nameid)
elif hasattr(context['user'], 'email') and context['user'].email:
url += '&email=' + urllib.quote(context['user'].email)
else:
# add an empty user
url += '&NameID='
cache_key = hashlib.md5(url).hexdigest()
cache_content = cache.get(cache_key)