有什么方法可以禁用用户自动注册吗?
我想要一个严格只供游客阅读的would网站。
为投稿人提供后台独家新闻。
我翻阅了文档,但我找不到任何这样的选择。
任何关于如何为此目的配置和保护ckan的建议都将受到欢迎。
发布于 2013-08-12 09:40:34
最简单的解决方案是编写一个实现IAuthFunctions接口并覆盖user_create auth函数的扩展。
下面是基本的扩展:
def no_registering(context, data_dict):
return {'success': False, 'msg': toolkit._('''You cannot register for this
site.''')}
class NoSelfRegistration(plugins.SingletonPlugin):
plugins.implements(plugins.IAuthFunctions, inherit=True)
def get_auth_functions(self):
return {
'user_create': no_registering
}UPDATE:我们目前正在实现一个配置选项(在https://github.com/okfn/ckan/pull/399上拉请求)。
发布于 2013-08-14 22:49:06
对于hub.HealthData.gov,我们创建了这个修补程序
https://github.com/HHS/ckan/commit/0102d4d7cee9151fc5fcfe31c56c485436eddda4
这就产生了一个新的配置选项ckan.auth。create_user,我们将其设置为false。
从那时起,它就一直在请求炼狱:
发布于 2016-02-25 14:27:06
这现在是CKAN的一个标准特性(至少在2.3.2版本之后,可能更早)。您可以使用 configuration options。
默认情况下,ckan.auth.create_user_via_api为false,而ckan.auth.create_user_via_web为true。
https://stackoverflow.com/questions/18171937
复制相似问题