Moqui表单显示已禁用

时间:2017-09-08 11:10:43

标签: moqui

我正在关注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>

当我点击“创建教程”时,表格会显示出来。但是,它被禁用(只读),包括提交按钮。

3 个答案:

答案 0 :(得分:1)

如果您正在关注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"/>

答案 1 :(得分:1)

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

<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. 如果要对可用的UserGroup(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组件:

我希望这会有所帮助!

答案 2 :(得分:0)

如果转换存在且用户有权访问它,则禁用所有字段都是错误,请通过创建问题进行报告。