问题
How can i go about redirecting ckan to a external URL unless logged in?
I added the following code below in ckan/logic/auth/get.py under the method site_read
if context.get('auth_user_obj') is not None:
return {'success': True}
else:
return {'success': False, 'msg': 'User not logged in. Pleaes authenticate with AD.'}
But i only get as far as just saying permission denied on each page unless logged in. Is there a way i can make it just redirect to an external url if not signed in or authenticated?
Thanks!
回答1:
Implement IRoutes interface
In the before_map function check if a user is logged in, if not use map.redirect to your external URL.
来源:https://stackoverflow.com/questions/51069265/how-to-redirect-ckan-to-external-url-unless-authorized-or-signed-in