示例#1
0
 public function testHasUserSharedRecords()
 {
     $user = new User(1, 2, 'test_user');
     $repo = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\Entity\\Repository\\AclSecurityIdentityRepository')->disableOriginalConstructor()->getMock();
     $repo->expects($this->once())->method('hasAclEntry')->willReturn(true);
     $manager = $this->getMockBuilder('\\Doctrine\\Common\\Persistence\\ObjectManager')->disableOriginalConstructor()->getMock();
     $manager->expects($this->once())->method('getRepository')->willReturn($repo);
     $this->registry->expects($this->once())->method('getManager')->willReturn($manager);
     $this->assertTrue($this->shareProvider->hasUserSidSharedRecords($user));
 }
示例#2
0
 /**
  * Determines if user has shared entity records exactly by UserSecurityIdentity.
  * If no UserInterface entity is passed then user will be taken from current context.
  *
  * @param UserInterface|null $user
  *
  * @return bool
  */
 public function hasUserSidSharedRecords(UserInterface $user = null)
 {
     if (!$user) {
         $user = $this->getLoggedUser();
     }
     return $this->shareProvider->hasUserSidSharedRecords($user);
 }