You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by mayo <am...@connextions.com> on 2008/12/17 22:57:29 UTC

possible bug with adding new permissions to group

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.


Re: possible bug with adding new permissions to group

Posted by Bruno Busco <br...@gmail.com>.
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 <am...@connextions.com>

>
> 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.
>
>