Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

$identifier cannot be empty, when creating class scope #13

Closed
mailaneel opened this Issue · 6 comments

3 participants

@mailaneel
$aclManager = $this->get('problematic.acl_manager');
$aclManager->setClassPermission('Entity\Subscriber', MaskBuilder::MASK_OWNER, 'ROLE_CLIENT');

internally setClassPermission is using $oid = ObjectIdentity::fromDomainObject($domainObject); instead i think we should check the type and then get the oid because for class type we should use new ObjectIdentity($identifier, $type)

@mailaneel

This is fix that i have added

 $oid = ($type == 'object')? ObjectIdentity::fromDomainObject($domainObject) : new ObjectIdentity('class',$domainObject);
@Problematic
Owner

Thanks for the help! If you can submit a pull request, I'll look it over and get it merged.

@mailaneel

Implemented this instead, ignore my pull

<?php

namespace WSL\BaseBundle\Entity;

use Doctrine\ORM\Mapping as ORM,
    Symfony\Component\Security\Acl\Model\DomainObjectInterface;

/**
 * WSL\BaseBundle\Entity\DomainObject
 * @MappedSuperclass
 */
class DomainObject implements DomainObjectInterface
{

    public function getObjectIdentifier()
    {
        $identifier = $this->getId();
        return (!empty($identifier)) ? $identifier : 'class';
    }

}
@Problematic
Owner

I still think there's value in being able to handle class-level ACLs without requiring extra code. I'm going to leave this open for now while I think it over.

@mailaneel

sure

@mailaneel mailaneel referenced this issue from a commit in mailaneel/ProblematicAclManagerBundle
@mailaneel mailaneel Reverted added fix for #13 1f0b9b4
@Problematic Problematic closed this issue from a commit
@mailaneel mailaneel closes #13 c1416b0
@sudent

I think the first fix is the right one, since our entity might extend from another base class and thus can't use the second @mailaneel fix. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.