how to redirect ckan to external url unless author

2019-07-23 20:58发布

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!

标签: adfs ckan
1条回答
ら.Afraid
2楼-- · 2019-07-23 21:02

Implement IRoutes interface

In the before_map function check if a user is logged in, if not use map.redirect to your external URL.

查看更多
登录 后发表回答