Openbravo Issue Tracking System - Retail Modules
View Issue Details
0039166Retail ModulesStoreServerpublic2018-08-22 10:042018-08-25 00:50
AugustoMauch 
AugustoMauch 
normalmajorhave not tried
closedfixed 
5
 
 
mtaal
No
0039166: Sometimes OBContext is not properly set in MobileServerController.TransitionToOnline process
The MobileServerController.TransitionToOnline tries to initialize the OBContext using a role of the user that defined the mobile servers. It does it by picking any role of that user that is not System.

The problem is that that condition was not enough, as if a role with userlevel O was selected, it would not have write access to the 0 organization.

Instead, the condition should be changed so a role with C or CO userlevel is picked.
See this log:

2018-08-21 17:28:09,201 [TransitionToOnlineThread] ERROR org.openbravo.base.exception.OBSecurityException - Organization 0 of object (BUTISMD_WS_LOG(8739475BE0E546C690EA46B3DF1B8865) (id: 8739475BE0E546C690EA46B3DF1B8865)) is not present in OrganizationList [50690BDE019F4DC09E2ACACAD86CAE12, 7617570B87DA47C4845225001932EF1C, E4E115113DB0444888DE8E3FD1507B40, 92D097D48DFD4F3C948E2A998806E9C1, A9F7DB099A5F401CB9A3ECFC29992664, 3A1AC7FAF2E84873ACEE64053A47845D, 40D0FD8FF6074783862D7D6A88CAB126, 3FD2A86DB15D4AC3A1BFF2DE8EE0D874, 860E5FB81FBC4F1CB5C9B65D2842F615, 666F00005B054CE49CB29F2A6D53FB2A, 6452669DBB3D431BB09C1B1B6FFB023E, A4A304A4E7654CBF9F55EEEEB05B40A5, B4F5AB1680154D57B7A84F317A04D8BF, B084A7EC01004294BF704560AD2CAD5C, CAC25C3E037A457BB7C153BD4
...
 at com.openbravo.but.integration.stockmd.PingProcess.doPingRequestBG(PingProcess.java:50)
        at com.openbravo.but.integration.stockmd.handlers.CheckStockMDOfflineHandler.isServerOffline(CheckStockMDOfflineHandler.java:35)
        at org.openbravo.mobile.core.servercontroller.MobileServerController$TransitionToOnline.tryTransitionToOnline(MobileServerController.java:750)

No tags attached.
Issue History
2018-08-22 10:04AugustoMauchNew Issue
2018-08-22 10:04AugustoMauchAssigned To => AugustoMauch
2018-08-22 10:04AugustoMauchTriggers an Emergency Pack => No
2018-08-22 13:25hgbotCheckin
2018-08-22 13:25hgbotNote Added: 0106443
2018-08-22 13:25hgbotStatusnew => resolved
2018-08-22 13:25hgbotResolutionopen => fixed
2018-08-22 13:25hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/4a9797af0ceae01477b72822c2ac14823c6f563d [^]
2018-08-22 13:25AugustoMauchReview Assigned To => mtaal
2018-08-25 00:50mtaalNote Added: 0106482
2018-08-25 00:50mtaalStatusresolved => closed

Notes
(0106443)
hgbot   
2018-08-22 13:25   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 4a9797af0ceae01477b72822c2ac14823c6f563d
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Aug 22 13:25:27 2018 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/4a9797af0ceae01477b72822c2ac14823c6f563d [^]

Fixes issue 39166: TransitionToOnline initialize OBContext with proper role

When the TransitionToOnline process is executed, it requires to initialize the OBContext with a role
other than System. The getAnyNonSystemRoleForClient method tried to do this, but it sometimes picked
a role with the Organization ("O") userLevel. This user level does not grant access to the root organization
automatically (see [1], only "S", "C" and "CO" do this).

Now, to select the role, instead of choosing any whose userlevel is not System, it will pick any whose
userlevel is C or CO.

[1] https://code.openbravo.com/erp/devel/pi/file/tip/src/org/openbravo/dal/core/OBContext.java#l619 [^]

---
M src/org/openbravo/mobile/core/servercontroller/MobileServerController.java
---
(0106482)
mtaal   
2018-08-25 00:50   
reviewed and tested