Get the permission repository.

@return EntityRepository
160873
private function getPermissionRepository()
    {
        if (null === $this->permissionRepo) {
            /** @var EntityRepository $repo */
            $repo = RepositoryUtils::getRepository($this->doctrine, PermissionInterface::class);
            $this->permissionRepo = $repo;
        }

        return $this->permissionRepo;
    }
525036
public function getPermissions()
    {
        return (!$this->permissions) ? $this->permissions = $this->rolePermissions()->get()->merge($this->userPermissions()->get()) : $this->permissions;
    }
1186257
public function getUserEntityRepository() 
    {
    	if(isset($this->er['User'])) {
    		return $this->er['User'];
    	}
    	$entityRepository = $this->getEntityManager()->getRepository('Neobazaar\Entity\User');
    	$entityRepository->setServiceLocator($this->getServiceManager());
    	$this->er['User'] = $entityRepository;
    	
    	return $this->er['User'];
    }
1150449
public function getTermTaxonomyEntityRepository() 
    {
    	if(isset($this->er['TermTaxonomy'])) {
    		return $this->er['TermTaxonomy'];
    	}
    	$this->er['TermTaxonomy'] = $this->getEntityManager()->getRepository('Neobazaar\Entity\TermTaxonomy');
    	
    	return $this->er['TermTaxonomy'];
    }
183265
public function revisionEntityAction()
    {
        $this->mapAllAuditedClasses();

        $page = (int)$this->getEvent()->getRouteMatch()->getParam('page');
        $revisionEntityId = (int) $this->getEvent()->getRouteMatch()->getParam('revisionEntityId');

        $revisionEntity = \SoliantEntityAudit\Module::getModuleOptions()->getEntityManager()
            ->getRepository('SoliantEntityAudit\\Entity\\RevisionEntity')->find($revisionEntityId);

        if (!$revisionEntity)
            return $this->plugin('redirect')->toRoute('audit');

        $repository = \SoliantEntityAudit\Module::getModuleOptions()->getEntityManager()
            ->getRepository('SoliantEntityAudit\\Entity\\RevisionEntity');

        return array(
            'page' => $page,
            'revisionEntity' => $revisionEntity,
            'auditService' => $this->getServiceLocator()->get('auditService'),
        );
    }
982080
public function getRepositoryManager()
    {
        if (!$this->started) {
            throw new LogicException('Puli was not started');
        }

        if (!$this->repositoryManager && $this->context instanceof ProjectContext) {
            $this->repositoryManager = new RepositoryManagerImpl(
                $this->context,
                $this->getRepository(),
                $this->getModuleManager()->findModules(Expr::method('isEnabled', Expr::same(true))),
                $this->getJsonStorage()
            );
        }

        return $this->repositoryManager;
    }
1257275
protected function getRepository($key)
    {
        $rep = $this->entityRepositories[$key];
        if ($rep) {
            return $this->getEntityManager()->getRepository($rep);
        }
    }
220175
public function getRepositoryPath() : string
    {
        if (empty($this->repositoryPath)) {
            $this->repositoryPath = (string) getcwd();
        }
        return $this->repositoryPath;
    }
603395
public function getBaseRepository()
    {
        if (null === $this->baseRepository) {
            $this->baseRepository = $this->getBaseDir().DIRECTORY_SEPARATOR.'repository';
        }

        return $this->baseRepository;
    }
132429
protected function getPermission()
    {
        // Get the display name.  This will go in the 'label' field.
        $label = ucwords($this->ask('Specify the display name for a new permission'));

        $name = null;

        // Make sure we get a valid key name for the permission.
        while (is_null($name)) {
            $name = $this->ask('What should the key name be set to?', Str::slug($label));

            // Make sure they approve the details for the new permission.
            if ($this->confirm("Your permission will be added as: \n\tLabel: $label \n\tName:  $name\nSave this permission?", true)) {
                $data = [
                    'name'       => $name,
                    'label'      => $label,
                    'created_at' => date('Y-m-d H:i:s'),
                ];

                // Add it to the database or detail an error has occurred and a new name needs to be supplied.
                try {
                    $this->db->table('rbac_permissions')->insert($data);
                } catch (QueryException $exception) {
                    $this->error('That name is already taken.  Please choose another.');

                    $name = null;
                    continue;
                }

                // Add the permission to our list.
                $this->permissions[] = (object)$data;

                $this->comment('Added!');
            } else {
                return true;
            }
        }

        // Allow them the chance to add another one.
        return $this->confirm('Add another permission?', true);
    }
683640
public function getRepository()
    {
        if (!$this->started) {
            throw new LogicException('Puli was not started');
        }

        if (!$this->context instanceof ProjectContext) {
            return null;
        }

        if (!$this->repo) {
            $this->repo = $this->getFactory()->createRepository();
        }

        return $this->repo;
    }
322740
public function getParentRepository()
    {
        $parent = $this->getRepository()->getDescription()->getProperty('parent');
        $parent = $this->getIdentifier($parent->getParent());

        return AnDomain::getRepository($parent);
    }
362457
public function getPermissionsForUuid($accessEntityUuid)
    {
        // Do not check the database if we haven't all data
        if ($accessEntityUuid == '') {
            return array();
        }
    
        try {
            $accessLevels = $this->getPermissionsRawForUuid($accessEntityUuid);
    
            $accessLevels = $this->runtimeManager->executeFilter('\\Zepi\\Core\\AccessControl\\Filter\\PermissionsBackend\\ResolvePermissions', $accessLevels);

            return $accessLevels;
        } catch (\Exception $e) {
            throw new Exception('Cannot load the permission for the given uuid "' . $accessEntityUuid . '".', 0, $e);
        }
    }
1360768
public function getRepository($entityName)
    {
        if ($entityName instanceof Entity) {
            $entityName = $entityName->getType();
        }

        if (!isset($this->repositories[$entityName])) {
            $plural = $this->getCollectionName($entityName);
            $this->repositories[$entityName] = $this->repositoryFactory->createRepository(
                $entityName,
                $plural
            );
        }

        return $this->repositories[$entityName];
    }
1132607
public function getPermissionsAttribute()
    {
        return $this->active_roles
            ->pluck('permissions')
            ->flatten()
            ->unique(function (PermissionContract $permission) {
                return $permission->getKey();
            });
    }
518498
public function postPermissionSource() {
		if ($this->owner->MyPermSourceID) {
			return $this->owner->MyPermSource();
		}

		$source = new PermissionParent();
		$source->Title = 'Posts for ' . $this->owner->getTitle();
		
		$owner = $this->owner;
		
		$this->transactionManager->run(function () use($source, $owner) {
			$source->write();
			$owner->MyPermSourceID = $source->ID;
			$owner->write();
		}, $owner);
		
		return $source;
	}
529692
public function getAllowedEntityIds(PermissionDefinition $permissionDef)
    {
        $rootEntity = $permissionDef->getEntity();
        if (empty($rootEntity)) {
            throw new InvalidArgumentException('You have to provide an entity class name!');
        }
        $builder = new MaskBuilder();
        foreach ($permissionDef->getPermissions() as $permission) {
            $mask = constant(get_class($builder) . '::MASK_' . strtoupper($permission));
            $builder->add($mask);
        }

        $query = new Query($this->em);
        $query->setHint('acl.mask', $builder->get());
        $query->setHint('acl.root.entity', $rootEntity);
        $sql = $this->getPermittedAclIdsSQLForUser($query);

        $rsm = new ResultSetMapping();
        $rsm->addScalarResult('id', 'id');
        $nativeQuery = $this->em->createNativeQuery($sql, $rsm);

        $transform = function ($item) {
            return $item['id'];
        };
        $result = array_map($transform, $nativeQuery->getScalarResult());

        return $result;
    }