Openbravo Issue Tracking System - Retail Modules
View Issue Details
0043954Retail ModulesWeb POSpublic2020-05-06 09:132020-06-03 12:36
gorkaion 
ranjith_qualiantech_com 
highmajoralways
closedfixed 
5
 
RR20Q3 
marvintm
No
0043954: ExternalOrderLoader wrong error management when user calling the EOL does not have access to Web POS form
The ExternalOrderLoader (EOL) when loading the POS Terminal provided in the json it tries to set up the OBContext based on it. To do so it tries to search a Role assigned to the user that is execuing the EOL that has access to that POS Terminal.

When the user does not have any role matching that condition. For example it only has the Admin role with the Web POS Form access removed. In this case no role is found and a NPE is thrown. This exception is caught in the importOrder() method but no message or trace in the log is left making very difficult the analysis to understand why has failed the EOL process.

We request 2 fixes to be made in the EOL process:

1. In case that no role is found a OBException with a descriptive message should be thrown instead of a NPE.
2. The importOrder method when it catches an unexpected exception it should leave a message in the log with the error.
1. Remove the access to the "Web POS" form to the Openbravo Admin role.
2. Create a user that only has access to that role or revoke any other role access to an existing user.
3. Call the EOL WebService using that user credentials.
4. Check that:
- result -1 is returned but no message.
- no error logs can be found in openbravo.log
No tags attached.
Issue History
2020-05-06 09:13gorkaionNew Issue
2020-05-06 09:13gorkaionAssigned To => Retail
2020-05-06 09:13gorkaionResolution time => 1590530400
2020-05-06 09:13gorkaionTriggers an Emergency Pack => No
2020-05-11 11:09maiteIssue Monitored: maite
2020-05-14 14:35ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2020-05-19 12:41ranjith_qualiantech_comStatusnew => scheduled
2020-05-20 03:08hgbotCheckin
2020-05-20 03:08hgbotNote Added: 0120071
2020-05-20 03:08hgbotStatusscheduled => resolved
2020-05-20 03:08hgbotResolutionopen => fixed
2020-05-20 03:08hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/f2ec12ca2abebfd896125b25bcbcbc05ee3c2997 [^]
2020-05-27 09:10marvintmNote Added: 0120326
2020-05-27 09:10marvintmStatusresolved => new
2020-05-27 09:10marvintmResolutionfixed => open
2020-05-27 09:16ranjith_qualiantech_comStatusnew => scheduled
2020-05-27 11:07hgbotCheckin
2020-05-27 11:07hgbotNote Added: 0120344
2020-05-31 08:07hgbotCheckin
2020-05-31 08:07hgbotNote Added: 0120477
2020-06-01 08:02ranjith_qualiantech_comStatusscheduled => resolved
2020-06-01 08:02ranjith_qualiantech_comResolutionopen => fixed
2020-06-01 14:18hgbotCheckin
2020-06-01 14:18hgbotNote Added: 0120493
2020-06-03 12:36marvintmReview Assigned To => marvintm
2020-06-03 12:36marvintmStatusresolved => closed
2020-06-03 12:36marvintmFixed in Version => RR20Q3

Notes
(0120071)
hgbot   
2020-05-20 03:08   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: f2ec12ca2abebfd896125b25bcbcbc05ee3c2997
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Wed May 20 06:38:17 2020 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/f2ec12ca2abebfd896125b25bcbcbc05ee3c2997 [^]

Fixed issue-43954 : Exception should be thrown if role not found for Webservice

* Updated getNearestRole Query by removing the webpos form validation for WebService

---
M src/org/openbravo/retail/posterminal/ExternalOrderLoader.java
M src/org/openbravo/retail/posterminal/POSLoginHandler.java
---
(0120326)
marvintm   
2020-05-27 09:10   
The fix is not what we want here. Conceptually, the ExternalOrderLoader should not require form access in the role used, as the context simply should be set to a role that supports webservices.

So, instead of the current fix, the "bypassSecurity" method should be overridden in the ExternalOrderLoader class.

It is also important to check that the ExternalOrderLoader is correctly requiring a role that has webservices access.
(0120344)
hgbot   
2020-05-27 11:07   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: d34892801860e3d17979bb9d2246f65a0cc4b1a7
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Wed May 27 12:51:24 2020 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/d34892801860e3d17979bb9d2246f65a0cc4b1a7 [^]

Related to issue-43954 : Backed out changeset: f2ec12ca2abe

---
M src/org/openbravo/retail/posterminal/ExternalOrderLoader.java
M src/org/openbravo/retail/posterminal/POSLoginHandler.java
---
(0120477)
hgbot   
2020-05-31 08:07   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 27671f3f91bb465c01d603f1f4f10bd22c8372bf
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Sun May 31 11:37:08 2020 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/27671f3f91bb465c01d603f1f4f10bd22c8372bf [^]

Related to issue-43954 : Added validation to check Webservice is enabled for User Role

* Context role should be used instead of User's Nearest Role

---
M src/org/openbravo/retail/posterminal/ExternalOrderLoader.java
---
(0120493)
hgbot   
2020-06-01 14:18   
Repository: erp/pmods/org.openbravo.service.integration.magento.mappings
Changeset: 9fdff601f6f2b959109c97a4acb85bd400c3f66b
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Mon Jun 01 17:48:21 2020 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.service.integration.magento.mappings/rev/9fdff601f6f2b959109c97a4acb85bd400c3f66b [^]

Related to issue-43954: Enabled Webservice for Role in junit tests

* Formatted Eclipse Java Eclipse code

---
M src-test/org/openbravo/service/integration/magento/mappings/inbound/MagentoImportBaseTest.java
M src-test/org/openbravo/service/integration/magento/mappings/inbound/orders/MagentoImportOrderEntityTest.java
---