除非登录,否则如何将 ckan 重定向到外部 URL?
我在 ckan/logic/auth/get.py 的 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.'}
但我只能说除非登录,否则每个页面上的权限都会被拒绝。有没有办法让它在未登录或未经过身份验证的情况下重定向到外部网址?
Thanks!
实施IRoutes接口 http://docs.ckan.org/en/latest/extensions/plugin-interfaces.html#ckan.plugins.interfaces.IRoutes
在 before_map 函数中检查用户是否已登录,如果未登录,则使用 map.redirect 到您的外部 URL。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)