Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
ID | ||||||||||||
0046217 | ||||||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
defect | [Openbravo ERP] A. Platform | minor | always | 2021-04-06 13:47 | 2022-02-01 07:24 | |||||||
Reporter | vmromanos | View Status | public | |||||||||
Assigned To | Triage Platform Base | |||||||||||
Priority | normal | Resolution | open | Fixed in Version | ||||||||
Status | new | Fix in branch | Fixed in SCM revision | |||||||||
Projection | none | ETA | none | Target Version | ||||||||
OS | Any | Database | Any | Java version | ||||||||
OS Version | Database version | Ant version | ||||||||||
Product Version | SCM revision | |||||||||||
Review Assigned To | ||||||||||||
Web browser | ||||||||||||
Modules | Core | |||||||||||
Regression level | ||||||||||||
Regression date | ||||||||||||
Regression introduced in release | ||||||||||||
Regression introduced by commit | ||||||||||||
Triggers an Emergency Pack | No | |||||||||||
Summary | 0046217: Organization entity and OBCriteria.setFilterOnReadableOrganization(true) won't work | |||||||||||
Description | In OBCriteria.initialize() we have the following code: if (isFilterOnReadableOrganization() && e.isOrganizationPartOfKey()) { add(Restrictions.in("id." + PROPERTY_ORGANIZATION + ".id", (Object[]) obContext.getReadableOrganizations())); } else if (isFilterOnReadableOrganization() && e.isOrganizationEnabled()) { add(Restrictions.in(PROPERTY_ORGANIZATION + ".id", (Object[]) obContext.getReadableOrganizations())); } In order to add the readable organizations filter the entity should either isOrganizationPartOfKey() or isOrganizationEnabled(). Both methods depend on variables set at Property.initializeName() method: if (getName().equals("organization")) { setClientOrOrganization(true); getEntity().setOrganizationEnabled(true); if (isId() || isPartOfCompositeId()) { getEntity().setOrganizationPartOfKey(true); } } In the case of the Organization entity we don't have a property called "organization" because it's actually the entity's "id", so Organization is never set as organizationEnabled or organizationPartOfKey, so the OBCriteria never adds the filter over the readable organizations. Note this is a corner case that should only happen when querying the Organization entity using the OBCriteria. Any other entity should be safe. Right now any OBCriteria over the Organization entity doesn't add any filter to readable organizations, which means the query is run for every organization (unless the OBCriteria instance adds an explicit filter over the organization's ids). | |||||||||||
Steps To Reproduce | Create a simple OBCriteria over Organization entity. Example: OBCriteria<Organization> orgCriteria = OBDal.getInstance().createCriteria(Organization.class); orgCriteria.setMaxResults(1); orgCriteria.uniqueResult(); Set a breakpoint at OBCriteria.initialize() [in the above code]. Verify isFilterOnReadableOrganization() is true, but the Restriction over the readable organizations is not added. | |||||||||||
Tags | No tags attached. | |||||||||||
Attached Files | ||||||||||||
Relationships [ Relation Graph ] [ Dependency Graph ] | ||||||||
|
Issue History | |||
Date Modified | Username | Field | Change |
2021-04-06 13:47 | vmromanos | New Issue | |
2021-04-06 13:47 | vmromanos | Assigned To | => platform |
2021-04-06 13:47 | vmromanos | Modules | => Core |
2021-04-06 13:47 | vmromanos | Triggers an Emergency Pack | => No |
2021-04-06 14:24 | vmromanos | Relationship added | related to 0046178 |
2022-02-01 07:24 | alostale | Assigned To | platform => Triage Platform Base |
Copyright © 2000 - 2009 MantisBT Group |