Skip to content

Custom ILocalRolesPlugin plugin breaks api.user.get_roles #458

@batlock666

Description

@batlock666

I have a custom PAS-plugin that implements interface ILocalRolesPlugin. To my surprise, this plugin breaks api.user.get_roles. Most of the time it works, but when I call the function like this:

api.user.get_roles(username=username, obj=obj, inherit=False)

I get the following exception:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/bvderbau/Projects/plone5.2-pcm2052-emptysharing/tryout.py", line 21, in <module>
    roles = api.user.get_roles(username=username, obj=obj, inherit=False)
  File "<decorator-gen-35>", line 2, in get_roles
  File "/home/bvderbau/.buildout/eggs/cp36m/plone.api-1.10.4-py3.6.egg/plone/api/validation.py", line 116, in wrapped
    return function(*args, **kwargs)
  File "/home/bvderbau/.buildout/eggs/cp36m/plone.api-1.10.4-py3.6.egg/plone/api/user.py", line 258, in get_roles
    for adapter in lrmanager._getAdapters(obj):
AttributeError: _getAdapters

It seems the problem is that my plugin is missing the method _getAdapters. This method is not required by the ILocalRolesPlugin interface. The only local roles plugin that has this method is in package borg.localrole. Are we supposed to use borg.localrole to assign local roles?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions