Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0053447Openbravo ERPA. Platformpublic2023-09-13 10:402023-09-13 10:40
ablasco 
Triage Platform Base 
normalminorhave not tried
newopen 
5
 
 
Core
No
0053447: Default Role, Org , client and WareHouse when login - code inconsistency
In Backend login, a default Role, Organization , client and WareHouse are assigned by default to the user.
But in some cases, this configuration could not be correctly applied when new changes are done in development.

DefaultOptionsData is generated with some database queries generated in :
/openbravo/src/org/openbravo/base/secureApp/DefaultOptions_data.xsql

There are two functions in order to get default info. ( e.g: defaultRole(), getDefaultRole() )

- The first one 'defaultRole()' checks if there is a 'default_ad_role_id' field related with the user in 'ad_user' table. This 'default_ad_role_id' is not verified properly with info in 'ad_user_roles' table.
If we remove roles in user window, default_ad_role_id could not be inside the user_roles table and it could be inconsistent.
 

- The second one 'getDefaultRole()' uses a hack trick with :
SELECT TO_CHAR(MIN(userRoles.AD_ROLE_ID)) AS DEFAULT_AD_ROLE_ID
FROM AD_USER_ROLES userRoles

In this query, if different roles are assigned to the user, it chooses one of them and it provides an alias as a 'DEFAULT_AD_ROLE_ID', but it doesn`t.


*This hack is used also in getDefaultWarehouse() and getDefaultSystemRole()

- default_ad_role_id , default_ad_org_id, default_m_warehouse_id, default_ad_client_id in users table should be reviewed when this values changes, if any of the roles related with user are removed or modified.
* This process requires development check in depth
No tags attached.
Issue History
2023-09-13 10:40ablascoNew Issue
2023-09-13 10:40ablascoAssigned To => Triage Platform Base
2023-09-13 10:40ablascoModules => Core
2023-09-13 10:40ablascoTriggers an Emergency Pack => No

There are no notes attached to this issue.