Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0032627Openbravo ERPA. Platformpublic2016-04-08 12:222016-06-17 19:36
alostale 
caristu 
normalmajorhave not tried
closedfixed 
5
 
3.0PR16Q3 
alostale
Core
No
0032627: template role cannot be used as session role
When a role marked as template is used to create a session, errors are logged when trying to save some preferences. This makes not possible to save ie. recent navigation items.
1. Create a new role:
  * name: bt
  * level: client+org
  * manual: yes
  * template: yes
    * org access: EspaƱa Norte
    * user: assignment: Openbravo
    * window access: Sales Order
2. Login with Openbravo user using that role
3. Open Sales Order window
  ERROR in log: 4388732 [http-8080-6] ERROR org.hibernate.LazyInitializationException - failed to lazily initialize a collection of role: ADRole.aDRoleInheritanceInheritFromList, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: ADRole.aDRoleInheritanceInheritFromList, no session or session was closed
    at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:383)
    at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:375)
    at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:368)
    at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:111)
    at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:272)
    at org.openbravo.role.inheritance.RoleInheritanceManager.propagateNewAccess(RoleInheritanceManager.java:380)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:45)
    at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
    at org.openbravo.role.inheritance.RoleInheritanceManager$Proxy$_$$_WeldClientProxy.propagateNewAccess(RoleInheritanceManager$Proxy$_$$_WeldClientProxy.java)
    at org.openbravo.role.inheritance.InheritedAccessEnabledEventHandler.doAction(InheritedAccessEnabledEventHandler.java:107)
    at org.openbravo.role.inheritance.InheritedAccessEnabledEventHandler.onSave(InheritedAccessEnabledEventHandler.java:69)
No tags attached.
related to defect 0032626 closed caristu cannot propagate privileges if a template role has been used in a session 
related to feature request 00309313.0PR16Q1 closed caristu Add ability to inherit role permissions 
depends on backport 00326303.0PR16Q2 closed caristu template role cannot be used as session role 
depends on backport 00326313.0PR16Q1.1 closed caristu template role cannot be used as session role 
Issue History
2016-04-08 12:22alostaleNew Issue
2016-04-08 12:22alostaleAssigned To => platform
2016-04-08 12:22alostaleModules => Core
2016-04-08 12:22alostaleTriggers an Emergency Pack => No
2016-04-08 12:22alostaleRelationship addedrelated to 0032626
2016-04-08 12:23alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=11714#r11714
2016-04-08 12:23alostaleRelationship addedrelated to 0030931
2016-04-08 12:24alostaleAssigned Toplatform => caristu
2016-04-08 12:25alostaleStatusnew => scheduled
2016-04-11 08:45hgbotCheckin
2016-04-11 08:45hgbotNote Added: 0085544
2016-04-11 08:45hgbotStatusscheduled => resolved
2016-04-11 08:45hgbotResolutionopen => fixed
2016-04-11 08:45hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/f7c2d3f60821875696fc7f5ce1150da6d2e633da [^]
2016-04-11 08:46caristuReview Assigned To => alostale
2016-04-14 17:13alostaleNote Added: 0085644
2016-04-14 17:13alostaleStatusresolved => new
2016-04-14 17:13alostaleResolutionfixed => open
2016-04-14 17:31hgbotCheckin
2016-04-14 17:31hgbotNote Added: 0085645
2016-04-14 17:43caristuStatusnew => scheduled
2016-04-14 17:46caristuStatusscheduled => resolved
2016-04-14 17:46caristuResolutionopen => fixed
2016-04-18 08:26alostaleNote Added: 0085683
2016-04-18 08:26alostaleStatusresolved => closed
2016-04-18 08:26alostaleFixed in Version => 3.0PR16Q3
2016-06-17 19:36hudsonbotCheckin
2016-06-17 19:36hudsonbotNote Added: 0087436
2016-06-17 19:36hudsonbotCheckin
2016-06-17 19:36hudsonbotNote Added: 0087449

Notes
(0085544)
hgbot   
2016-04-11 08:45   
Repository: erp/devel/pi
Changeset: f7c2d3f60821875696fc7f5ce1150da6d2e633da
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Fri Apr 08 14:58:03 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/f7c2d3f60821875696fc7f5ce1150da6d2e633da [^]

fixes issue 32627: template role cannot be used as session role
Now the injector used for preferences returns the complete Role object and not a proxy, in order to prevent possible LazyInitializationException when using a template role as session role.
This was happening because some preferences are created at system level when a session role is making use of the UI. It is also verified that after fixing this issue, those preferences are not being propagated, thanks to the preference black list.

---
M src/org/openbravo/role/inheritance/access/PreferenceAccessInjector.java
---
(0085644)
alostale   
2016-04-14 17:13   
Unnecessary casting:
  return (Role) OBDal.getInstance().get(Role.class, roleId);
(0085645)
hgbot   
2016-04-14 17:31   
Repository: erp/devel/pi
Changeset: e27f72c3ca89d9344752d89db9b0aaa18c788ead
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Thu Apr 14 17:28:52 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/e27f72c3ca89d9344752d89db9b0aaa18c788ead [^]

related to issue 32627: removed unnecessary casting

---
M src/org/openbravo/role/inheritance/access/PreferenceAccessInjector.java
---
(0085683)
alostale   
2016-04-18 08:26   
code reviewed + tested
(0087436)
hudsonbot   
2016-06-17 19:36   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/0dc7be081b1c [^]
Maturity status: Test
(0087449)
hudsonbot   
2016-06-17 19:36   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/0dc7be081b1c [^]
Maturity status: Test