Plone 5.2-Relation Choice - What permission does a user need in an add form to select an object in a related items field?

I'm having an issue with add forms where a relation choice will not search for objects for users who are not a Site Administrator. Instead, it sits there with the load icon spinning.
At one point, after going in to the zope manager and removing all error types from the errors ignored, I did get a 'you don't have permission error, but it didn't specify what the missing permission was. Unfortunately, I can't seem to replicate this either.

My schema:

class IMyContentType(model.schema):

    distributor = RelationChoice(title=u"Distributor",
            'selectableTypes': ['Organization',],

The users are all able to access the Organizations through navigation and the issue I'm having is only in Add Forms. When a user visits the Edit Form, the relation field works, the user being able to type and getting organization they want.

I did try specifying basePath to where the organizations are stored in case that made a difference, but the path it set was butchered, like it removed certain characters. (i.e. '/organizations' gave '/izations').

I assume this might be a permissions error. Is there a specific permission for using a related items/related field items widget for an Add Form?

For me this piece of code do the job, its from a behavior, but that shouldn't matter.

def basePath(context=None):
    uid = api.portal.get_registry_record(
        "my.addon.supervisorfolder", default=None
    if not uid:
        folder = api.portal.get()
        folder = api.content.get(UID=uid)

    return "/".join(folder.getPhysicalPath())

class IContact(model.Schema):

    model.fieldset("contact", label=_("Contact"), fields=["supervisors"])

    supervisors = schema.List(
            description=_("Select the right Supervisor"),

            "selectableTypes": ["Supervisor"],
            "favorites": False,
            "recentlyUsed": True,
            "basePath": basePath,

in another project i use an adapter to override the permsission on vocabulary requests:

<!-- Adapter Permission Checker for Vocabulary in Registration Form -->
  factory=".validator.CourseOfStudiesFieldPermissionChecker" />
from import GenericFormFieldPermissionChecker

class CourseOfStudiesFieldPermissionChecker(GenericFormFieldPermissionChecker):
  def validate(self, field_name, vocabulary_name=None):
    return (vocabulary_name and vocabulary_name == 'myaddon.course_of_studies')
class IStudentSubscribeForm(model.Schema):
  course_of_studies = schema.Choice(
    title = _(u"Course of Studies"),
    required = True,

1 Like

Thank you for the response.
I didn't mean to delete my initial response, but I was able to get it to work using your example. I forgot to replace source=CatalogSource with the vocabulary = ''.

I'm not sure why CatalogSource is having issues with non-administrators in add forms, but with RelatedItemsFieldWidget's pattern options covering selectable items, the vocabulary is fine to use (?). One of the fields I'm using queries for is related_my_content_types and my site contains over 1000 'My Content Types', and the widget performs well.

Edit: While using CatalogSource, I was curious about the javascript, what was being passed back when the field is supposed to be populated, so I opened in Firefox the debugger and while it was loading infinitely, it had this message:
Line 6366 - TypeError: o is undefined.

While it was paused at the error, I hovered my mouse over the variable that is supposed to contain results (data), but it was undefined (line 6344).

Maybe help this


Hi. Yes that's causing the problem. I went into buildout-cache/eggs/ and in saw that exact code. When I removed the checking and re-ran the instance, it worked.
I tried removing the current version from buildout cache and re-ran buildout. It grabbed the same version (3.8.7) and I can't find anything pinning it to that version. Is there a 3.x version I can pin to that fixes this or should I just copy the fixed version of into my source directory and use that?

The fix is not in a 3.x Release, the main branch is for Plone 6. you can fix it self in your local branch, based on a 3.x in the src dir.

1 Like

Thanks. I appreciate your responses. I'll go for that approach.