Skip to content

Plugin

UserDatasetsPlugin

Bases: SingletonPlugin

"UserDatasetsPlugin.

This plugin replaces dataset and resource authentication calls to allow users with the 'Member' role to create datasets, and edit/delete their own datasets (but not others).

Source code in ckanext/userdatasets/plugin.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class UserDatasetsPlugin(SingletonPlugin):
    """
    "UserDatasetsPlugin.

    This plugin replaces dataset and resource authentication calls to allow users with
    the 'Member' role to create datasets, and edit/delete their own datasets (but not
    others).
    """

    implements(interfaces.IAuthFunctions)
    implements(interfaces.IActions)

    # IAuthFunctions
    def get_auth_functions(self):
        """
        Implementation of IAuthFunctions.get_auth_functions.
        """
        from ckanext.userdatasets.logic.auth import create, delete, get, update

        auth = create_auth(create, delete, update, get)
        return auth

    # IActions
    def get_actions(self):
        """
        Implementation of IActions.get_actions.
        """
        from ckanext.userdatasets.logic.action import create, get, update

        actions = create_actions(create, get, update)
        return actions

get_actions()

Implementation of IActions.get_actions.

Source code in ckanext/userdatasets/plugin.py
35
36
37
38
39
40
41
42
def get_actions(self):
    """
    Implementation of IActions.get_actions.
    """
    from ckanext.userdatasets.logic.action import create, get, update

    actions = create_actions(create, get, update)
    return actions

get_auth_functions()

Implementation of IAuthFunctions.get_auth_functions.

Source code in ckanext/userdatasets/plugin.py
25
26
27
28
29
30
31
32
def get_auth_functions(self):
    """
    Implementation of IAuthFunctions.get_auth_functions.
    """
    from ckanext.userdatasets.logic.auth import create, delete, get, update

    auth = create_auth(create, delete, update, get)
    return auth