how to redirect ckan to external url unless authorized or signed in

一笑奈何 提交于 2019-12-11 01:12:38

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!