You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.
The following line is wrong : $oid = $this->getObjectIdentityRetrievalStrategy()->getObjectIdentity($domainObject); in the way that use the wrong service (in addPermissionfunction)
By default SecurityComponent provide this service security.acl.object_identity_retrieval_strategy but he can be apply only for DomainObject not for Object. And in case of call AddClassPermission or serClassPermission you didn't work with DomainObject but with Object.
Here the code of ObjectIdentityRetrievalStrategy provided by default :
So when add class permission like : $aclManager->addClassPermission(Media::CLASS, MaskBuilder::MASK_OPERATOR, $sid); That trigger InvalidDomainObjectException and do nothing.
So, may i'm wrong ? or you must create your own ObjectIdentityRetrievalStrategy service to fix it ? (or dont call ObjectIdentityRetrievalStrategyin case of Object
So in my project I made a quick fix, to create my own service ObjectIdentityRetrievalStrategy, it's only for my need so to make it proper we must implement some setter, to configure identifier, but I only use class for this moment.
NOTE: On your example you show this : $aclManager->addClassPermission($comment, MaskBuilder::MASK_OWNER, $userEntity); But when we work with Object the right call is $aclManager->addClassPermission(Comment::CLASS, MaskBuilder::MASK_OWNER, $userEntity); because it's not a DomainObject We want add the permission of all instance of $comment, not specially $comment.
The text was updated successfully, but these errors were encountered:
jjsaunier
changed the title
AclManager RetrievalStrategy is wrong
AclManager RetrievalStrategy is wrong (I think)
Oct 14, 2014
Hey,
About this function :
When you enter in her via this function :
The following line is wrong :
$oid = $this->getObjectIdentityRetrievalStrategy()->getObjectIdentity($domainObject);
in the way that use the wrong service (inaddPermission
function)By default SecurityComponent provide this service
security.acl.object_identity_retrieval_strategy
but he can be apply only forDomainObject
not forObject
. And in case of callAddClassPermission
orserClassPermission
you didn't work withDomainObject
but withObject
.Here the code of
ObjectIdentityRetrievalStrategy
provided by default :So when add class permission like :
$aclManager->addClassPermission(Media::CLASS, MaskBuilder::MASK_OPERATOR, $sid);
That triggerInvalidDomainObjectException
and do nothing.So, may i'm wrong ? or you must create your own
ObjectIdentityRetrievalStrategy
service to fix it ? (or dont callObjectIdentityRetrievalStrategy
in case ofObject
So in my project I made a quick fix, to create my own service ObjectIdentityRetrievalStrategy, it's only for my need so to make it proper we must implement some setter, to configure identifier, but I only use
class
for this moment.NOTE: On your example you show this :
$aclManager->addClassPermission($comment, MaskBuilder::MASK_OWNER, $userEntity);
But when we work withObject
the right call is$aclManager->addClassPermission(Comment::CLASS, MaskBuilder::MASK_OWNER, $userEntity);
because it's not aDomainObject
We want add the permission of all instance of $comment, not specially $comment.The text was updated successfully, but these errors were encountered: