Moqui 表单显示为已禁用

Moqui form shows up disabled

我正在学习 Moqui 入门教程。我创建了一个创建表单,如下所示。

<?xml version="1.0" encoding="UTF-8"?>
<screen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://staging.azpire.co.in/xsd/xml-screen-2.1.xsd"
    require-authentication="anonymous-all">

    <transition name="findTutorial"><default-response url="."/></transition>
    <transition name="createTutorial">
        <service-call name="create#tutorial.Tutorial"></service-call>
        <default-response url="."/>
    </transition>

    <actions>
        <entity-find entity-name="tutorial.Tutorial" list="tutorialList">
            <search-form-inputs/>
        </entity-find>
    </actions>

    <widgets>

        <container-dialog button-text="Create Tutorial" id="CreateTutorialDialog">
            <form-single name="CreateTutorial" transition="createTutorial">
                <auto-fields-entity entity-name="tutorial.Tutorial" field-type="edit"/>
                <field name="submitButton">
                    <default-field title="Create"><submit/></default-field>
                </field>
            </form-single>
        </container-dialog>

        <form-list name="ListTutorials" list="tutorialList" transition="findTutorial">
            <auto-fields-entity entity-name="tutorial.Tutorial" field-type="find-display"/>
        </form-list>
    </widgets>
</screen>

当我点击 "Create Tutorial" 时,表格出现了。但是,它被禁用(只读),包括提交按钮。

如果转换存在并且用户有权访问它,那么禁用所有字段是一个错误,请通过创建问题报告它。

如果您正在按照 Moqui 入门教程进行操作,则需要按如下方式导入有关安全屏幕的数据以解决此问题:

    <moqui.security.ArtifactGroup artifactGroupId="TUTORIAL" description="Tutorial"/>
    <moqui.security.ArtifactGroupMember artifactGroupId="TUTORIAL" artifactTypeEnumId="AT_XML_SCREEN"
                                            inheritAuthz="Y" artifactName="component://tutorial/screen/tutorial.xml"/>
<!-- Full permissions for the ADMIN user group -->
    <moqui.security.ArtifactAuthz artifactAuthzId="TUTORIAL_AUTHZ_ALL" userGroupId="ADMIN" artifactGroupId="TUTORIAL"
                                      authzTypeEnumId="AUTHZT_ALWAYS" authzActionEnumId="AUTHZA_ALL"/>

如果您需要一个过渡的临时解决方案,那么您可以使用:

<transition name="createTutorial" read-only="true">
    <service-call name="create#tutorial.Tutorial"></service-call>
    <default-response url="."/>
</transition>

如果您需要一个临时解决方案但需要更多过渡,那么您可以使用:

<always-actions>
    <script>ec.artifactExecution.disableAuthz()</script>
</always-actions>
<transition name="createTutorial">
    <service-call name="create#tutorial.Tutorial"></service-call>
    <default-response url="."/>
</transition>
<transition name="createEmployee">
    <service-call name="create#employee.Employee"></service-call>
    <default-response url="."/>
</transition>

如果您想要永久解决方案,请创建以下种子数据记录:

  1. 如果您想为可用用户组 (ADMIN) 授权,则必须添加以下种子数据: <moqui.security.ArtifactGroup artifactGroupId="ADMIN_ARTIFACTS" description="Administrators"/> <!-- for screen path --> <moqui.security.ArtifactGroupMember artifactGroupId="ADMIN_ARTIFACTS" artifactTypeEnumId="AT_XML_SCREEN" nameIsPattern="N" inheritAuthz="Y" artifactName="component://tutorial/screen/tutorial.xml"/> <!-- for rest calls --> <moqui.security.ArtifactGroupMember artifactGroupId="ADMIN_ARTIFACTS" artifactName="/tutorial/fetch-records" artifactTypeEnumId="AT_REST_PATH" nameIsPattern="N" inheritAuthz="Y"/> <!-- for service path --> <moqui.security.ArtifactGroupMember artifactGroupId="ADMIN_ARTIFACTS" artifactName="TutorialServices.create#Records" artifactTypeEnumId="AT_SERVICE" nameIsPattern="N" inheritAuthz="Y"/> <!-- Give authrization to UserGroup: --> <moqui.security.ArtifactAuthz artifactAuthzId="ADMIN_AUTHZ" userGroupId="ADMIN" artifactGroupId="ADMIN_ARTIFACTS" authzTypeEnumId="AUTHZT_ALWAYS" authzActionEnumId="AUTHZA_ALL"/>

  2. 如果您想创建自己的 UserGroupType,则必须添加以下种子数据:

    <moqui.basic.Enumeration enumTypeId="UserGroupType" enumId="UgtMyAdmin" description="My Administrators"/> // If you want to create your own UserGroup then you have to add following seed data: <moqui.security.UserGroup groupTypeEnumId="UgtMyAdmin" userGroupId="MyAdmin" description="My Administrators"/> // you can also create artifact group separately: <moqui.security.ArtifactGroup artifactGroupId="MY_ADMIN_ARTIFACTS" description="My Administrators"/> // Now you have to give screen permission to your own created UserGroup: <!-- for screen path --> <moqui.security.ArtifactGroupMember artifactGroupId="MY_ADMIN_ARTIFACTS" artifactTypeEnumId="AT_XML_SCREEN" nameIsPattern="N" inheritAuthz="Y" artifactName="component://tutorial/screen/tutorial.xml"/> <!-- for rest calls --> <moqui.security.ArtifactGroupMember artifactGroupId="MY_ADMIN_ARTIFACTS" artifactName="/tutorial/fetch-records" artifactTypeEnumId="AT_REST_PATH" nameIsPattern="N" inheritAuthz="Y"/> <!-- for service path --> <moqui.security.ArtifactGroupMember artifactGroupId="MY_ADMIN_ARTIFACTS" artifactName="TutorialServices.create#Records" artifactTypeEnumId="AT_SERVICE" nameIsPattern="N" inheritAuthz="Y"/> <!-- Give authrization to UserGroup: --> <moqui.security.ArtifactAuthz artifactAuthzId="MY_ADMIN_AUTH" userGroupId="MyAdmin" artifactGroupId="MY_ADMIN_ARTIFACTS" authzTypeEnumId="AUTHZT_ALWAYS" authzActionEnumId="AUTHZA_ALL"/>

您还可以从 git:

克隆一个 example 组件

希望对您有所帮助!