-
Sorry for my newbie question, but I'm a Python novice, and no experience with Flask. I'm trying to make a middleware plugin that prevents anonymous access to my CKAN site, but I'm also using the ldap extension, so I need to check if the ckanext-ldap-user session key is set to determine if the user is logged in. Gist: https://gist.github.com/ipimpat/5b9614db4c1e4794cc5d50a347e4a8ef How ever I get this error when trying to access the session:
In my code I have this method which should check if the ckanext-ldap-user session key exists. In the top of my code I'm importing the session variable from ckan.common import config, session And then try to use it like this def _is_logged_in(self, environ):
# check if the request belongs to an authenticated session
if 'ckanext-ldap-user' in session: # <-- this breaks
return True
elif 'repoze.who.identity' in environ:
return True
return False |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
|
Beta Was this translation helpful? Give feedback.
session
is not defined, as the error says. You just haveself
andenviron
available.