Skip to content

Helpers

can_edit()

Check editing permissions for updating agent directly.

Returns:

Type Description

True if user can edit agents, False if not

Source code in ckanext/attribution/lib/helpers.py
15
16
17
18
19
20
21
22
23
24
25
def can_edit():
    """
    Check editing permissions for updating agent directly.

    :returns: True if user can edit agents, False if not
    """
    try:
        permitted = toolkit.check_access('agent_update', {}, {})
        return permitted
    except toolkit.NotAuthorized:
        return False

get_contributions(pkg_id)

Template access for the :func:~ckanext.attribution.model.crud.PackageQuery.get_contributions query method.

Parameters:

Name Type Description Default
pkg_id

the ID of the package

required

Returns:

Type Description

list of activities associated with the package

Source code in ckanext/attribution/lib/helpers.py
32
33
34
35
36
37
38
39
40
def get_contributions(pkg_id):
    """
    Template access for the
    :func:`~ckanext.attribution.model.crud.PackageQuery.get_contributions` query method.

    :param pkg_id: the ID of the package
    :returns: list of activities associated with the package
    """
    return PackageQuery.get_contributions(pkg_id)