Magnolia CMS 5.5.5 Choose from roles

五迷三道 提交于 2020-01-13 06:57:08

问题


I am looking for a possibility to choose certain roles in a Page property Dialog. Some parts of the page should be only viewable to certain roles.

What I got is

- name: allowedRoles
  class: info.magnolia.ui.form.field.definition.MultiValueFieldDefinition
  label: Select Roles
  field:
    name: roleLinkField
    class: info.magnolia.ui.form.field.definition.LinkFieldDefinition
    targetWorkspace: userroles
    appName: security
    identifierToPathConverter:
      class: info.magnolia.ui.form.field.converter.BaseIdentifierToPathConverter

This lets me only choose user not userroles.. What do I need to do to choose from the subapp of "security" called "roles"?


回答1:


Ok, this took a while to figure out, but turns out relatively simple in the end:

  • define chooseDialog in the app from which you want to choose from different subapp explicitly (in your case in security-app)
  • in the chooseDialog, define workbench field pointing to workbench in subapp of interest (roles in your case). Class definition for the field must be specified here explicitly.
  • also in chooseDialog, define contentConnector pointing to connector of interest (in roles subapp in your case)
  • in the dialog where you are adding the link field, in the definition of the link field, set appName to the app (security in your case) and set targetWorkspace to the workspace of the connector you linked from chooseDialog in the step above (userroles in your case).

All should work then. Limitation is that you can have only one such choose dialog definition per app so you have to choose from which subapp you want to link items from.

Example of configuration for what you want: https://gist.github.com/rah003/29910e92067effaebed9156d6bdc293a

HTH,
Jan



来源:https://stackoverflow.com/questions/46035079/magnolia-cms-5-5-5-choose-from-roles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!