This is an automated email from the ASF dual-hosted git repository. jleroux pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push: new f6a2af5be6 Improved: Agreement Roles - VIEW permissions (OFBIZ-12518) (#471) f6a2af5be6 is described below commit f6a2af5be6b3975d394352308d32368714d3621e Author: Pierre Smits <pierre.sm...@somonar.com> AuthorDate: Sun Apr 14 09:11:45 2024 +0200 Improved: Agreement Roles - VIEW permissions (OFBIZ-12518) (#471) * Improved: Agreement Roles - VIEW permissions (OFBIZ-12518) Currently, a user with only 'VIEW' permissions, as demonstrated in trunk demo with userId = auditor, accessing the Agreement Roles screen, sees editable fields and/or triggers (to requests) reserved for users with 'CREATE' or 'UPDATE' permissions. To see/test: https://localhost:8443/accounting/control/EditAgreementRoles?agreementId=8000 modified: - AgreementScreens.xml - restructured screen EditAgreementRoles to work with permissions - AgreementForms.xml - added grid AgreementRoles for users with VIEW permissions additional cleanup * Update AgreementForms.xml --------- Co-authored-by: Jacques Le Roux <jacques.le.r...@les7arts.com> Respectively replaces labels CommonParty and CommonRole by PartyPartyId and PartyRoleTypeId Note that anyway even and admin could not create an agreement role, see https://issues.apache.org/jira/browse/OFBIZ-12518. I guess it's due to the change to entity-auto, did not dig deeper. --- applications/accounting/widget/AgreementForms.xml | 25 ++++++++++------ .../accounting/widget/AgreementScreens.xml | 34 +++++++++++++++++----- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/applications/accounting/widget/AgreementForms.xml b/applications/accounting/widget/AgreementForms.xml index 09332f065f..247d57bba4 100644 --- a/applications/accounting/widget/AgreementForms.xml +++ b/applications/accounting/widget/AgreementForms.xml @@ -729,18 +729,25 @@ under the License. </hyperlink> </field> </grid> - - <grid name="ListAgreementRoles" list-name="agreementRoles" paginate-target="EditAgreementRoles" + <grid name="AgreementRoles" list-name="agreementRoles" paginate-target="EditAgreementRoles" odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar"> - <actions> - <entity-and entity-name="AgreementRole" use-cache="true" list="agreementRoles"> - <field-map field-name="agreementId" from-field="agreementId"/> - </entity-and> - </actions> <auto-fields-entity entity-name="AgreementRole" default-field-type="display"/> <field name="agreementId"><hidden/></field> - <field name="partyId" title="${uiLabelMap.PartyPartyId}"><display/></field> - <field name="roleTypeId" title="${uiLabelMap.PartyRoleTypeId}"><display/></field> + <field name="partyId" title="${uiLabelMap.PartyPartyId}"> + <display-entity also-hidden="false" entity-name="PartyNameView" + key-field-name="partyId" description="[${partyId}] ${groupName}${firstName} ${lastName}"/> + </field> + <field name="roleTypeId" title="${uiLabelMap.PartyRoleTypeId}"><display-entity entity-name="RoleType"/></field> + </grid> + <grid name="ListAgreementRoles" list-name="agreementRoles" paginate-target="EditAgreementRoles" + odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar"> + <auto-fields-entity entity-name="AgreementRole" default-field-type="edit"/> + <field name="agreementId"><hidden/></field> + <field name="partyId" title="${uiLabelMap.PartyPartyId}"> + <display-entity also-hidden="false" entity-name="PartyNameView" + key-field-name="partyId" description="[${partyId}] ${groupName}${firstName} ${lastName}"/> + </field> + <field name="roleTypeId" title="${uiLabelMap.PartyRoleTypeId}"><display-entity entity-name="RoleType"/></field> <field name="deleteLink" title=" " widget-style="buttontext"> <hyperlink description="${uiLabelMap.CommonRemove}" target="deleteAgreementRole" also-hidden="false"> <parameter param-name="agreementId"/> diff --git a/applications/accounting/widget/AgreementScreens.xml b/applications/accounting/widget/AgreementScreens.xml index 4c3bf9d098..eb0095963d 100644 --- a/applications/accounting/widget/AgreementScreens.xml +++ b/applications/accounting/widget/AgreementScreens.xml @@ -873,21 +873,39 @@ under the License. <set field="titleProperty" value="PageTitleFindAgreementRoles"/> <set field="tabButtonItem" value="AgreementRoles"/> <set field="helpAnchor" value="_help_for_edit_agreements_roles"/> - <property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/> <set field="agreementId" from-field="parameters.agreementId"/> <entity-one entity-name="Agreement" value-field="agreement" auto-field-map="true"/> + <entity-condition entity-name="AgreementRole" list="agreementRoles"> + <order-by field-name="partyId"/> + <order-by field-name="roleTypeId"/> + </entity-condition> </actions> <widgets> <decorator-screen name="CommonAgreementDecorator" location="${parameters.agreementDecoratorLocation}"> <decorator-section name="body"> - <screenlet id="add-agreement-roles" title="${uiLabelMap.PageTitleAddAgreementRoles}" collapsible="true"> - <section> - <widgets> + <section> + <condition> + <and> + <or> + <if-has-permission permission="ACCOUNTING" action="_CREATE"/> + <if-has-permission permission="ACCOUNTING" action="_UPDATE"/> + </or> + </and> + </condition> + <widgets> + <screenlet id="add-agreement-roles" title="${uiLabelMap.PageTitleAddAgreementRoles}" collapsible="true"> <include-form name="AddAgreementRole" location="component://accounting/widget/AgreementForms.xml"/> - </widgets> - </section> - </screenlet> - <include-grid name="ListAgreementRoles" location="component://accounting/widget/AgreementForms.xml"/> + </screenlet> + <screenlet id="AgreementRoles" title="${uiLabelMap.CommonRoles}"> + <include-grid name="ListAgreementRoles" location="component://accounting/widget/AgreementForms.xml"/> + </screenlet> + </widgets> + <fail-widgets> + <screenlet id="AgreementRoles" title="${uiLabelMap.CommonRoles}"> + <include-grid name="AgreementRoles" location="component://accounting/widget/AgreementForms.xml"/> + </screenlet> + </fail-widgets> + </section> </decorator-section> </decorator-screen> </widgets>