Author: deepak
Date: Tue Oct 17 10:07:57 2017 New Revision: 1812382 URL: http://svn.apache.org/viewvc?rev=1812382&view=rev Log: Improved: Proper use of if-has-permission, Apply slightly modified patch from jira issue, if if-has-permission uses _ADMIN permission to check condition, so its good to have old pattern instead of using permission/action pattern. Thanks Suraj Khurana for your contribution(OFBIZ-9740) Modified: ofbiz/ofbiz-plugins/trunk/birt/widget/birt/BirtMenus.xml ofbiz/ofbiz-plugins/trunk/myportal/widget/MyPortalMenus.xml ofbiz/ofbiz-plugins/trunk/projectmgr/minilang/ProjectPermissionServices.xml ofbiz/ofbiz-plugins/trunk/projectmgr/widget/ProjectMenus.xml ofbiz/ofbiz-plugins/trunk/projectmgr/widget/ProjectScreens.xml ofbiz/ofbiz-plugins/trunk/projectmgr/widget/TaskScreens.xml ofbiz/ofbiz-plugins/trunk/scrum/widget/TaskScreens.xml ofbiz/ofbiz-plugins/trunk/scrum/widget/scrumMenus.xml ofbiz/ofbiz-plugins/trunk/scrum/widget/scrumScreens.xml Modified: ofbiz/ofbiz-plugins/trunk/birt/widget/birt/BirtMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/birt/widget/birt/BirtMenus.xml?rev=1812382&r1=1812381&r2=1812382&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/birt/widget/birt/BirtMenus.xml (original) +++ ofbiz/ofbiz-plugins/trunk/birt/widget/birt/BirtMenus.xml Tue Oct 17 10:07:57 2017 @@ -34,7 +34,7 @@ under the License. <menu name="FlexibleBirtTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml"> <menu-item name="ListFlexibleReport" title="${uiLabelMap.BirtManageReports}"> <condition> - <if-has-permission permission="BIRT_UPDATE"/> + <if-has-permission permission="BIRT" action="_UPDATE"/> </condition> <link target="ListFlexibleReport"/> </menu-item> @@ -42,7 +42,7 @@ under the License. <!-- enable this only for test <menu-item name="deleteReports" title="${uiLabelMap.BirtDeleteFlexibeReports}"> <condition> - <if-has-permission permission="BIRT_DELETE"/> + <if-has-permission permission="BIRT" action="_DELETE"/> </condition> <link target="DeleteAllFlexibleReports" confirmation-message="${uiLabelMap.BirtConfirmDeleteFlexibleReports}" request-confirmation="true"/> </menu-item> Modified: ofbiz/ofbiz-plugins/trunk/myportal/widget/MyPortalMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/myportal/widget/MyPortalMenus.xml?rev=1812382&r1=1812381&r2=1812382&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/myportal/widget/MyPortalMenus.xml (original) +++ ofbiz/ofbiz-plugins/trunk/myportal/widget/MyPortalMenus.xml Tue Oct 17 10:07:57 2017 @@ -53,7 +53,7 @@ under the License. </menu-item> <menu-item name="portalAdmin" title="${uiLabelMap.MyPortalAdminPortalPage}"> <condition> - <and><if-has-permission permission="WEBTOOLS_VIEW"/> + <and><if-has-permission permission="WEBTOOLS" action="_VIEW"/> <or> <if-has-permission permission="MYPORTALBASE_ADMIN"/> </or> Modified: ofbiz/ofbiz-plugins/trunk/projectmgr/minilang/ProjectPermissionServices.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/projectmgr/minilang/ProjectPermissionServices.xml?rev=1812382&r1=1812381&r2=1812382&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/projectmgr/minilang/ProjectPermissionServices.xml (original) +++ ofbiz/ofbiz-plugins/trunk/projectmgr/minilang/ProjectPermissionServices.xml Tue Oct 17 10:07:57 2017 @@ -22,7 +22,7 @@ xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd"> <simple-method method-name="projectMgrRequestPermission" short-description="Make sure the sure the user can read the requests for the projects"> - <if-has-permission permission="PROJECTMGR" action="ADMIN"> + <if-has-permission permission="PROJECTMGR_ADMIN"> <set field="hasPermission" value="true" type="Boolean"/> <else> <set field="hasPermission" value="false" type="Boolean"/> @@ -87,12 +87,12 @@ <if-compare field="isMember" value="true" operator="equals"/> </and> <and> - <if-has-permission permission="PROJECTMGR_VIEW"/> - <not><if-has-permission permission="PROJECTMGR_ROLE_VIEW"/></not> + <if-has-permission permission="PROJECTMGR" action="_VIEW"/> + <not><if-has-permission permission="PROJECTMGR_ROLE" action="_VIEW"/></not> <if-compare field="parameters.mainAction" value="VIEW" operator="equals"/> </and> <and> - <if-has-permission permission="PROJECTMGR_ROLE_VIEW"/> + <if-has-permission permission="PROJECTMGR_ROLE" action="_VIEW"/> <if-compare field="isMember" value="true" operator="equals"/> <if-compare field="parameters.mainAction" value="VIEW" operator="equals"/> </and> @@ -129,12 +129,12 @@ <if-compare field="isMember" value="true" operator="equals"/> </and> <and> - <if-has-permission permission="PROJECTMGR_VIEW"/> - <not><if-has-permission permission="PROJECTMGR_ROLE_VIEW"/></not> + <if-has-permission permission="PROJECTMGR" action="_VIEW"/> + <not><if-has-permission permission="PROJECTMGR_ROLE" action="_VIEW"/></not> <if-compare field="parameters.mainAction" value="VIEW" operator="equals"/> </and> <and> - <if-has-permission permission="PROJECTMGR_ROLE_VIEW"/> + <if-has-permission permission="PROJECTMGR_ROLE" action="_VIEW"/> <if-compare field="isMember" value="true" operator="equals"/> <if-compare field="parameters.mainAction" value="VIEW" operator="equals"/> </and> @@ -206,17 +206,17 @@ <if-compare field="isMember" value="true" operator="equals"/> </and> <and> - <if-has-permission permission="PROJECTMGR_VIEW"/> - <not><if-has-permission permission="PROJECTMGR_ROLE_VIEW"/></not> + <if-has-permission permission="PROJECTMGR" action="_VIEW"/> + <not><if-has-permission permission="PROJECTMGR_ROLE" action="_VIEW"/></not> <if-compare field="parameters.mainAction" value="VIEW" operator="equals"/> </and> <and> - <if-has-permission permission="PROJECTMGR_ROLE_VIEW"/> + <if-has-permission permission="PROJECTMGR_ROLE" action="_VIEW"/> <if-compare field="isMember" value="true" operator="equals"/> <if-compare field="parameters.mainAction" value="VIEW" operator="equals"/> </and> <and> - <if-has-permission permission="PROJECTMGR_ROLE_TASK_CREATE"/> + <if-has-permission permission="PROJECTMGR_ROLE_TASK" action="_CREATE"/> <!-- if-compare field="isMember" value="true" operator="equals"/--><!-- currently disabled because the workEffortParentId is supplied but is empty here --> <or> <if-compare field="parameters.mainAction" value="CREATE" operator="equals"/> @@ -249,17 +249,17 @@ <or> <if-has-permission permission="PROJECTMGR_ADMIN"/> <and> - <if-has-permission permission="PROJECTMGR_VIEW"/> + <if-has-permission permission="PROJECTMGR" action="_VIEW"/> <if-compare field="mainAction" value="VIEW" operator="equals"/> </and> <and> - <if-has-permission permission="PROJECTMGR_TIMESHEET_CREATE"/> - <not><if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_CREATE"/></not> + <if-has-permission permission="PROJECTMGR_TIMESHEET" action="_CREATE"/> + <not><if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET" action="_CREATE"/></not> <if-compare field="mainAction" value="CREATE" operator="equals"/> </and> <and> - <if-has-permission permission="PROJECTMGR_TIMESHEET_UPDATE"/> - <not><if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_UPDATE"/></not> + <if-has-permission permission="PROJECTMGR_TIMESHEET" action="_UPDATE"/> + <not><if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET" action="_UPDATE"/></not> <if-compare field="mainAction" value="UPDATE" operator="equals"/> </and> <and><!-- can always create ones own timesheet --> @@ -302,27 +302,27 @@ <if-empty field="parameters.timesheetId"/> <if-has-permission permission="PROJECTMGR_ADMIN"/> <and> - <if-has-permission permission="PROJECTMGR_VIEW"/> + <if-has-permission permission="PROJECTMGR" action="_VIEW"/> <if-compare field="mainAction" value="VIEW" operator="equals"/> </and> <and> - <if-has-permission permission="PROJECTMGR_TIMESHEET_CREATE"/> - <not><if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_CREATE"/></not> + <if-has-permission permission="PROJECTMGR_TIMESHEET" action="_CREATE"/> + <not><if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET" action="_CREATE"/></not> <if-compare field="mainAction" value="CREATE" operator="equals"/> </and> <and> - <if-has-permission permission="PROJECTMGR_TIMESHEET_UPDATE"/> - <not><if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_UPDATE"/></not> + <if-has-permission permission="PROJECTMGR_TIMESHEET" action="_UPDATE"/> + <not><if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET" action="_UPDATE"/></not> <if-compare field="mainAction" value="UPDATE" operator="equals"/> </and> <and> - <if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_CREATE"/> + <if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET" action="_CREATE"/> <if-compare field="mainAction" value="CREATE" operator="equals"/> <if-compare-field field="partyId" to-field="parameters.userLogin.partyId" operator="equals"/> <if-compare field="isMember" value="true" operator="equals"/> </and> <and> - <if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET_UPDATE"/> + <if-has-permission permission="PROJECTMGR_ROLE_TIMESHEET" action="_UPDATE"/> <if-compare field="mainAction" value="UPDATE" operator="equals"/> <if-compare-field field="partyId" to-field="parameters.userLogin.partyId" operator="equals"/> <if-compare field="isMember" value="true" operator="equals"/> Modified: ofbiz/ofbiz-plugins/trunk/projectmgr/widget/ProjectMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/projectmgr/widget/ProjectMenus.xml?rev=1812382&r1=1812381&r2=1812382&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/projectmgr/widget/ProjectMenus.xml (original) +++ ofbiz/ofbiz-plugins/trunk/projectmgr/widget/ProjectMenus.xml Tue Oct 17 10:07:57 2017 @@ -238,7 +238,7 @@ <condition> <and> <if-compare field="hasUpdatePermission" operator="equals" value="true"/> - <if-has-permission permission="PROJECTMGR" action="_ADMIN"/> + <if-has-permission permission="PROJECTMGR_ADMIN"/> </and> </condition> <link target="EditProject"/> Modified: ofbiz/ofbiz-plugins/trunk/projectmgr/widget/ProjectScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/projectmgr/widget/ProjectScreens.xml?rev=1812382&r1=1812381&r2=1812382&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/projectmgr/widget/ProjectScreens.xml (original) +++ ofbiz/ofbiz-plugins/trunk/projectmgr/widget/ProjectScreens.xml Tue Oct 17 10:07:57 2017 @@ -54,7 +54,7 @@ under the License. <widgets> <section> <condition> - <not><if-has-permission permission="PROJECTMGR" action="_ADMIN"/></not> + <not><if-has-permission permission="PROJECTMGR_ADMIN"/></not> </condition> <actions> <set field="parameters.partyId" from-field="parameters.userLogin.partyId"/> @@ -933,9 +933,8 @@ under the License. <condition> <or> <if-has-permission permission="PROJECTMGR_ADMIN"/> - <if-has-permission permission="PROJECTMGR_ROLE_ADMIN"/> - <if-has-permission permission="PROJECTMGR_ROLE_TASK_CREATE"/> - <if-has-permission permission="PROJECTMGR_ROLE_UPDATE"/> + <if-has-permission permission="PROJECTMGR_ROLE_TASK" action="_CREATE"/> + <if-has-permission permission="PROJECTMGR_ROLE" action="_UPDATE"/> </or> </condition> <widgets> @@ -1070,10 +1069,7 @@ under the License. <decorator-section name="body"> <section> <condition> - <or> - <if-has-permission permission="PROJECTMGR_ADMIN"/> - <if-has-permission permission="PROJECTMGR_VIEW"/> - </or> + <if-has-permission permission="PROJECTMGR" action="_VIEW"/> </condition> <widgets> <screenlet id="searchOptions" name="findScreenlet" collapsible="true" title="${uiLabelMap.CommonSearchOptions}" initially-collapsed="true"> @@ -1102,10 +1098,7 @@ under the License. <label style="h1" text="${uiLabelMap[titleProperty]}"/> <section> <condition> - <or> - <if-has-permission permission="PROJECTMGR_ADMIN"/> - <if-has-permission permission="PROJECTMGR_VIEW"/> - </or> + <if-has-permission permission="PROJECTMGR" action="_VIEW"/> </condition> <widgets> <include-screen name="commOverview" location="component://party/widget/partymgr/CommunicationEventScreens.xml" /> Modified: ofbiz/ofbiz-plugins/trunk/projectmgr/widget/TaskScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/projectmgr/widget/TaskScreens.xml?rev=1812382&r1=1812381&r2=1812382&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/projectmgr/widget/TaskScreens.xml (original) +++ ofbiz/ofbiz-plugins/trunk/projectmgr/widget/TaskScreens.xml Tue Oct 17 10:07:57 2017 @@ -169,10 +169,7 @@ under the License. <decorator-section name="body"> <section> <condition> - <or> - <if-has-permission permission="PROJECTMGR_ADMIN"/> - <if-has-permission permission="PROJECTMGR_VIEW"/> - </or> + <if-has-permission permission="PROJECTMGR" action="_VIEW"/> </condition> <widgets> <screenlet title="${uiLabelMap.PageTitleFindTask}" collapsible="true" id="findTask"> @@ -519,10 +516,9 @@ under the License. <section> <condition> <or> - <if-has-permission permission="PROJECTMGR_ADMIN"/> - <if-has-permission permission="PROJECTMGR_ROLE_ADMIN"/> - <if-has-permission permission="PROJECTMGR_ROLE_TASK_CREATE"/> - <if-has-permission permission="PROJECTMGR_ROLE_UPDATE"/> + <if-has-permission permission="PROJECTMGR_ADMIN" action=""/> + <if-has-permission permission="PROJECTMGR_ROLE_TASK" action="_CREATE"/> + <if-has-permission permission="PROJECTMGR_ROLE" action="_UPDATE"/> </or> </condition> <widgets> Modified: ofbiz/ofbiz-plugins/trunk/scrum/widget/TaskScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/scrum/widget/TaskScreens.xml?rev=1812382&r1=1812381&r2=1812382&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/scrum/widget/TaskScreens.xml (original) +++ ofbiz/ofbiz-plugins/trunk/scrum/widget/TaskScreens.xml Tue Oct 17 10:07:57 2017 @@ -456,7 +456,7 @@ under the License. <screenlet title="${uiLabelMap.ScrumMgrTaskTeam}"> <section> <condition> - <if-has-permission permission="SCRUM" action="_ADMIN"/> + <if-has-permission permission="SCRUM_ADMIN"/> </condition> <widgets> <include-form name="ListTaskParties" location="component://scrum/widget/TaskForms.xml"/> Modified: ofbiz/ofbiz-plugins/trunk/scrum/widget/scrumMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/scrum/widget/scrumMenus.xml?rev=1812382&r1=1812381&r2=1812382&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/scrum/widget/scrumMenus.xml (original) +++ ofbiz/ofbiz-plugins/trunk/scrum/widget/scrumMenus.xml Tue Oct 17 10:07:57 2017 @@ -273,7 +273,7 @@ under the License. <condition> <and> <or> - <if-has-permission permission="SCRUM_ADMIN"/> + <if-has-permission permission="SCRUM" action="_ADMIN"/> </or> <not><if-empty field="product"/></not> <if-empty field="product.supportDiscontinuationDate"/> @@ -288,7 +288,7 @@ under the License. <condition> <and> <or> - <if-has-permission permission="SCRUM_ADMIN"/> + <if-has-permission permission="SCRUM" action="_ADMIN"/> </or> <not><if-empty field="product"/></not> <if-empty field="product.supportDiscontinuationDate"/> @@ -326,7 +326,7 @@ under the License. <condition> <and> <or> - <if-has-permission permission="SCRUM_PRODUCT_ROLE_VIEW"/> + <if-has-permission permission="SCRUM_PRODUCT_ROLE" action="_VIEW"/> <if-service-permission service-name="scrumPermissionCheck" main-action="UPDATE" resource-description="BACKLOG"/> </or> <not><if-empty field="product"/></not> @@ -427,7 +427,7 @@ under the License. <if-service-permission service-name="scrumPermissionCheck" main-action="CREATE" resource-description="TASK"/> <or> <and> - <if-has-permission permission="SCRUM_PRODUCT_ADMIN"/> + <if-has-permission permission="SCRUM_PRODUCT" action="_ADMIN"/> <if-compare operator="equals" value="CRQ_ACCEPTED" field="custRequestMap.statusId"/> </and> </or> Modified: ofbiz/ofbiz-plugins/trunk/scrum/widget/scrumScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/scrum/widget/scrumScreens.xml?rev=1812382&r1=1812381&r2=1812382&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/scrum/widget/scrumScreens.xml (original) +++ ofbiz/ofbiz-plugins/trunk/scrum/widget/scrumScreens.xml Tue Oct 17 10:07:57 2017 @@ -2884,7 +2884,7 @@ under the License. <widgets> <section> <condition> - <if-has-permission permission="SCRUM_PRODUCT_ROLE_VIEW"/> + <if-has-permission permission="SCRUM_PRODUCT_ROLE" action="_VIEW"/> </condition> <widgets> <section> |
Free forum by Nabble | Edit this page |