问题描述
我正在寻找一种在Page属性对话框中选择某些角色的可能性。页面的某些部分仅对某些角色可见。
我得到的是
-名称:allowedRoles
类:info.magnolia.ui.form.field.definition.MultiValueFieldDefinition
标签:选择角色
字段:
名称:roleLinkField
类:info.magnolia.ui.form.field.definition.LinkFieldDefinition
targetWorkspace:用户角色
appName:安全性
identifierToPathConverter:
类:info.magnolia.ui .form.field.converter.BaseIdentifierToPathConverter
这让我只能选择用户而不是userroles。需要从安全子应用程序中选择角色吗?
好吧,这花了一段时间才能弄清楚,但最终却相对简单:
- 在要从其他子应用程序中明确选择的应用程序中定义
chooseDialog
(在您的情况下,security-app
) - 在
chooseDialog
中,定义指向工作台的工作台字段在感兴趣的子应用中(您的情况为角色)。 - 也在
chooseDialog
中,定义contentConnector
指向感兴趣的连接器(在您的情况下为角色子应用程序) - 在添加链接字段的对话框中,在链接字段的定义中,设置
appName
到应用程序(在您的情况下为安全性
)并设置targetWorkspace
到上一步中从chooseDialog
链接到的连接器的工作空间(在您的情况下为userroles
)。
所有操作均应正常进行。局限性在于,每个应用程序只能有一个这样的选择对话框定义,因此您必须选择要从中链接项目的子应用程序。
配置示例想要:
HTH,
1月
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"?
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 insecurity-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
, definecontentConnector
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 settargetWorkspace
to the workspace of the connector you linked fromchooseDialog
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
这篇关于Magnolia CMS 5.5.5从角色中选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!