Question

Is there some way to disable user auto-registration in ckan?

I'd like to have a ckan site that would be strictly read-only for visitors

with a back-end exclusive for contributors.

I went through the docs, but I couldn't find any option like that.

any advice on how to configure and secure ckan for such a purpose would be welcome

Was it helpful?

Solution

The easiest solution is to write an extension that implements the IAuthFunctions interface and override the user_create auth function.

Here is the basic extension:

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: We are currently implementing a config option to do this (pull request at https://github.com/okfn/ckan/pull/399).

OTHER TIPS

For hub.HealthData.gov, we created this patch

https://github.com/HHS/ckan/commit/0102d4d7cee9151fc5fcfe31c56c485436eddda4

which makes a new config option ckan.auth. create_user which we set to false.

It has been in pull request purgatory since then:

https://github.com/okfn/ckan/pull/399

This is now a standard feature of CKAN (at least since version 2.3.2, perhaps earlier). You can use the ckan.auth.create_user_via_api and ckan.auth.create_user_via_web configuration options.

By default, ckan.auth.create_user_via_api is false but ckan.auth.create_user_via_web is true.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top