svn commit: r689818 - in /ofbiz/trunk/applications/accounting: webapp/accounting/invoice/NoAccountingView.fo.ftl widget/AccountingPrintScreens.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r689818 - in /ofbiz/trunk/applications/accounting: webapp/accounting/invoice/NoAccountingView.fo.ftl widget/AccountingPrintScreens.xml

hansbak-2
Author: hansbak
Date: Thu Aug 28 06:47:23 2008
New Revision: 689818

URL: http://svn.apache.org/viewvc?rev=689818&view=rev
Log:
put security on check printing and viewing pdf invoices

Added:
    ofbiz/trunk/applications/accounting/webapp/accounting/invoice/NoAccountingView.fo.ftl   (with props)
Modified:
    ofbiz/trunk/applications/accounting/widget/AccountingPrintScreens.xml

Added: ofbiz/trunk/applications/accounting/webapp/accounting/invoice/NoAccountingView.fo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/NoAccountingView.fo.ftl?rev=689818&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/invoice/NoAccountingView.fo.ftl (added)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/invoice/NoAccountingView.fo.ftl Thu Aug 28 06:47:23 2008
@@ -0,0 +1,21 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<#escape x as x?xml>
+           <fo:block text-align="center">${uiLabelMap.AccountingViewPermissionError}</fo:block>
+</#escape>

Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/invoice/NoAccountingView.fo.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/invoice/NoAccountingView.fo.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/invoice/NoAccountingView.fo.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/accounting/widget/AccountingPrintScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/AccountingPrintScreens.xml?rev=689818&r1=689817&r2=689818&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/AccountingPrintScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/AccountingPrintScreens.xml Thu Aug 28 06:47:23 2008
@@ -32,45 +32,61 @@
                 <property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
                 <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
                 <set field="title" value="Invoice"/>
-                <script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy"/>                
+                <script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy"/>
+                <script location="component://party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy"/>                
             </actions>
             <widgets>
-                <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml">
-                    <decorator-section name="topLeft">
-                        <section>
-                            <widgets>
+                <section>
+                    <condition>
+                        <or>
+                            <if-has-permission permission="ACCOUNTING" action="_VIEW"/>
+                            <!-- can always see own invoice -->
+                            <if-compare field-name="invoice.partyIdFrom" operator="equals" value="${userLogin.partyId}" />
+                            <if-compare field-name="invoice.partyId" operator="equals" value="${userLogin.partyId}" />
+                            <!-- or is a contact of a company who owns the invoice-->
+                            <if-compare field-name="invoice.partyIdFrom" operator="equals" value="${myCompanyId}" />
+                            <if-compare field-name="invoice.partyId" operator="equals" value="${myCompanyId}" />
+                        </or>
+                    </condition>
+                    <widgets>
+                        <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml">
+                            <decorator-section name="topLeft">
                                 <include-screen name="CompanyLogo" location="component://order/widget/ordermgr/OrderPrintScreens.xml"/>
-                            </widgets>
-                        </section>
-                    </decorator-section>
-                    <decorator-section name="topRight">
-                        <section>
-                            <widgets>
-                                <platform-specific>
+                            </decorator-section>
+                            <decorator-section name="topRight">
+                               <platform-specific>
                                     <xsl-fo><html-template location="component://accounting/webapp/accounting/invoice/invoiceReportHeaderInfo.fo.ftl"/></xsl-fo>
                                 </platform-specific>
-                            </widgets>
-                        </section>
-                    </decorator-section>
-                    <decorator-section name="body">
-                        <section>
-                            <widgets>
-                                <platform-specific>
-                                    <xsl-fo><html-template location="component://accounting/webapp/accounting/invoice/invoiceReportContactMechs.fo.ftl"/></xsl-fo>
-                                </platform-specific>
+                            </decorator-section>
+                            <decorator-section name="body">
+                               <platform-specific>
+                                   <xsl-fo><html-template location="component://accounting/webapp/accounting/invoice/invoiceReportContactMechs.fo.ftl"/></xsl-fo>
+                              </platform-specific>
+                               <platform-specific>
+                                   <xsl-fo><html-template location="component://accounting/webapp/accounting/invoice/invoiceReportItems.fo.ftl"/></xsl-fo>
+                               </platform-specific>
+                            </decorator-section>
+                        </decorator-screen>
+                    </widgets>
+                    <fail-widgets>
+                        <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml">
+                            <decorator-section name="body">
                                 <platform-specific>
-                                    <xsl-fo><html-template location="component://accounting/webapp/accounting/invoice/invoiceReportItems.fo.ftl"/></xsl-fo>
+                                    <xsl-fo><html-template location="component://accounting/webapp/accounting/invoice/NoAccountingView.fo.ftl"/></xsl-fo>
                                 </platform-specific>
-                            </widgets>
-                        </section>
-                    </decorator-section>
-                </decorator-screen>
+                            </decorator-section>
+                        </decorator-screen>
+                    </fail-widgets>
+                </section>
             </widgets>
         </section>
     </screen>
     
     <screen name="PrintCheckPDF">
         <section>
+            <condition>
+                <if-has-permission permission="ACCOUNTING" action="_VIEW"/>
+            </condition>
             <actions>
                 <set field="title" value="Check"/>
             </actions>
@@ -79,6 +95,9 @@
                     <xsl-fo><html-template location="component://accounting/webapp/accounting/payment/printCheck.fo.ftl"/></xsl-fo>
                 </platform-specific>                
             </widgets>
+            <fail-widgets>
+                <label style="h3" text="${uiLabelMap.AccountingPrintChecksPermissionError}"/>
+            </fail-widgets>
         </section>
     </screen>    
 </screens>
\ No newline at end of file