possible bug with adding new permissions to group

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

possible bug with adding new permissions to group

mayo
Is this where i would post bugs that I see in OFBiz?  I have a bug and a possible solution detailed below.  I found the error on OFBiz 4.0.  Is there a similar bug in the most recent version?

Bug:
I noticed that when I added a permission to a security group (partymgr/control/addSecurityPermissionToSecurityGroup) that the permissions wouldn't be immediately applied because org.ofbiz.security.Security.securityGroupPermissionCache had the wrong value if that permission was already cached.  For instance, I log in with testuser to the order manager and it fails. I give the testuser the order manager view permission and try to log in again, but it still says I dont have permissions.

Reason:
I noticed the cache would update correctly when I take permissions away, but the cache wouldn't clear when I added new permissions.  The addSecurityPermissionToSecurityGroup service (securityext/script/org/ofbiz/securityext/securitygroup/SecurityGroupServices.xml) attempts to remove the cached security group permission but it fails to find the key. The key given for cache removal is newEntity, but after the newEntity is created it is assigned all the entity's values (like the createdStamp and createdTxStamp).   The cache key should only have the PK values.

Possible Fix:
Either you can call securityGroupPermissionCache.remove(newEntity) before the new <create-value value-name="newEntity"/> is called or you can make a lookupPKMap that only has the PK values and then use lookupPKMap to remove the permission cache.


<make-value value-name="lookupPKMap" entity-name="SecurityGroupPermission"/>
<set-pk-fields map-name="parameters" value-name="lookupPKMap"/>
<call-bsh>
<![CDATA[ org.ofbiz.security.Security.securityGroupPermissionCache.remove(lookupPKMap); ]]>
</call-bsh>


Reply | Threaded
Open this post in threaded view
|

Re: possible bug with adding new permissions to group

Bruno Busco
Hi Mayo,
I think this bug is still present in the trunk becouse I noticed it also.

You could open a JIRA and attach a patch.
This is the standard way to contribute to the project.
Please read this as a reference:
http://docs.ofbiz.org/display/OFBADMIN/OFBiz+Contributors+Best+Practices

-Bruno

2008/12/17 mayo <[hidden email]>

>
> Is this where i would post bugs that I see in OFBiz?  I have a bug and a
> possible solution detailed below.  I found the error on OFBiz 4.0.  Is
> there
> a similar bug in the most recent version?
>
> Bug:
> I noticed that when I added a permission to a security group
> (partymgr/control/addSecurityPermissionToSecurityGroup) that the
> permissions
> wouldn't be immediately applied because
> org.ofbiz.security.Security.securityGroupPermissionCache had the wrong
> value
> if that permission was already cached.  For instance, I log in with
> testuser
> to the order manager and it fails. I give the testuser the order manager
> view permission and try to log in again, but it still says I dont have
> permissions.
>
> Reason:
> I noticed the cache would update correctly when I take permissions away,
> but
> the cache wouldn't clear when I added new permissions.  The
> addSecurityPermissionToSecurityGroup service
>
> (securityext/script/org/ofbiz/securityext/securitygroup/SecurityGroupServices.xml)
> attempts to remove the cached security group permission but it fails to
> find
> the key. The key given for cache removal is newEntity, but after the
> newEntity is created it is assigned all the entity's values (like the
> createdStamp and createdTxStamp).   The cache key should only have the PK
> values.
>
> Possible Fix:
> Either you can call securityGroupPermissionCache.remove(newEntity) before
> the new <create-value value-name="newEntity"/> is called or you can make a
> lookupPKMap that only has the PK values.
>
> <make-value value-name="lookupPKMap"
> entity-name="SecurityGroupPermission"/>
> <set-pk-fields map-name="parameters" value-name="lookupPKMap"/>
>
>
> --
> View this message in context:
> http://www.nabble.com/possible-bug-with-adding-new-permissions-to-group-tp21062427p21062427.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
>
>