@param \Concrete\Core\Permission\Access\Entity\Entity[] $accessEntities

@return \Concrete\Core\Permission\Access\Entity\Entity[]
439647
public function validateAndFilterAccessEntities($accessEntities)
    {
        $entities = [];
        foreach ($accessEntities as $ae) {
            if ($ae->validate($this)) {
                $entities[] = $ae;
            }
        }

        return $entities;
    }
734177
public static function getPermissionHandles($permissions)
    {
        foreach ($permissions as &$permission) {
            //determine if permission references element, get handle if it does
            if (preg_match('/(:\w)/', $permission)) {
                $permissionParts = explode(":", $permission);
                $element = null;
                $hasUids = MigrationManagerHelper::isVersion('3.1');
                
                if (preg_match('/entries|entrydrafts/', $permissionParts[0])) {
                    $element = $hasUids ? Craft::$app->sections->getSectionByUid($permissionParts[1]) : Craft::$app->sections->getSectionById($permissionParts[1]);
                } elseif (preg_match('/volume/', $permissionParts[0])) {
                    $element = $hasUids ? Craft::$app->volumes->getVolumeByUid($permissionParts[1]) : Craft::$app->volumes->getVolumeById($permissionParts[1]);
                } elseif (preg_match('/categories/', $permissionParts[0])) {
                    $element = $hasUids ? Craft::$app->categories->getGroupByUid($permissionParts[1]) : Craft::$app->categories->getGroupById($permissionParts[1]);
                } elseif (preg_match('/globalset/', $permissionParts[0])) {
                    $element = $hasUids ? MigrationManagerHelper::getGlobalSetByUid($permissionParts[1]) : Craft::$app->globals->getSetByid($permissionParts[1]);
                }           

                if ($element != null) {
                    $permission = $permissionParts[0].':'.$element->handle;
                }
            }
        }

        return $permissions;
    }
563567
public function getAccessLevels()
    {
        // Give the modules the opportunity to add additional access levels
        $runtimeManager = $this->framework->getRuntimeManager();
        
        $accessLevels = $runtimeManager->executeFilter('\\Zepi\\Core\\AccessControl\\Filter\\AccessLevelManager\\RegisterAccessLevels', $this->accessLevels);
        
        return $accessLevels;
    }
107791
private function flattenArrayOfLimitationsForCurrentUser(array $hasAccess): array
    {
        $currentUserId = $this->permissionResolver->getCurrentUserReference()->getUserId();

        if (\is_array($this->flattenArrayOfLimitations[$currentUserId])) {
            return $this->flattenArrayOfLimitations[$currentUserId];
        }

        $limitations = [];
        foreach ($hasAccess as $permissionSet) {
            if ($permissionSet['limitation'] !== null) {
                $limitations[] = $permissionSet['limitation'];
            }
            /** @var \eZ\Publish\API\Repository\Values\User\Policy $policy */
            foreach ($permissionSet['policies'] as $policy) {
                $policyLimitations = $policy->getLimitations();
                if (!empty($policyLimitations)) {
                    foreach ($policyLimitations as $policyLimitation) {
                        $limitations[$policy->id][] = $policyLimitation;
                    }
                }
            }
        }

        return $this->flattenArrayOfLimitations[$currentUserId] = $limitations;
    }
1206685
public function getByAccessToken(AccessTokenEntity $accessToken)
    {
        $result = $this->getConnection()->table('oauth_sessions')
                ->select('oauth_sessions.*')
                ->join('oauth_access_tokens', 'oauth_sessions.id', '=', 'oauth_access_tokens.session_id')
                ->where('oauth_access_tokens.id', $accessToken->getId())
                ->first();

        if (is_null($result)) {
            return;
        }

        return (new SessionEntity($this->getServer()))
               ->setId($result->id)
               ->setOwner($result->owner_type, $result->owner_id);
    }
206249
public function toArray(array $keys = [], $accessLevel = \ReflectionProperty::IS_PUBLIC, $underscoreKeys = false)
    {
        $collection = [];
        $reflection = new \ReflectionObject($this);
        
        foreach ($reflection->getProperties($accessLevel) as $property) {
            
            if (empty($keys) || in_array($property->getName(), $keys, true)) {
                
                $propertyValue = $property->getValue($this);
                $propertyName = $underscoreKeys ? Inflector::underscore($property->getName()) : $property->getName();
                
                $collection[$propertyName] = ($propertyValue instanceof EntityInterface)
                    ? $propertyValue->toArray([], $accessLevel) : $propertyValue;
                
            }
        }
        
        return $collection;
    }
75769
public function getSearchedEntities()
    {
        $entities = array();

        if (!empty($_REQUEST['Entities'])) {
            if (is_array($_REQUEST['Entities'])) {
                $entities = Convert::raw2att($_REQUEST['Entities']);
            } else {
                $entities = explode(',', Convert::raw2att($_REQUEST['Entities']));
                $entities = array_combine($entities, $entities);
            }
        }
        
        return $entities;
    }
889277
public function getAccessPolicyList()
    {
        $propertyList = $this->_getEntityList('AccessPolicies');
        $result = [];

        foreach ($propertyList as $properties) {
            $result[] = AccessPolicy::createFromOptions($properties);
        }

        return $result;
    }
647617
public function checkEntities($entities)
    {
        return array_filter($entities, function ($val) {
            $entityClass = $this->entityClass;
            return ($val instanceof $entityClass);
        });
    }
1331329
protected function wrapInEntities(array $entities)
    {
        $results = array();
        foreach ($entities as $entity) {
            $results[] = self::getEntity($entity);
        }

        return $results;
    }
525191
public function getAccessibleRoles(array $roles)
    {
        $accessibleRoles = $roles;
        foreach ($roles as $role) {
            /**
             * @var $role Role
             */
            if (isset($this->map[$role->getRole()])) {
                foreach ($this->map[$role->getRole()] as $r) {
                    $accessibleRoles[] = new Role($r);
                }
            }
        }

        return $accessibleRoles;
    }
124560
public function getRootLocationsBySiteAccesses(array $siteAccesses)
    {
        $rootLocations = [];

        foreach ($siteAccesses as $siteAccess) {
            $rootLocationId = $this->getRootLocationBySiteAccessName($siteAccess);

            $rootLocations[$rootLocationId] = $rootLocationId;
        }

        return array_keys($rootLocations);
    }
435914
public function getExpandedAclList(array $accessList) {
        $entries = [];

        foreach ($accessList as $publicKey => $privateKey) {
            if (is_array($privateKey)) {
                throw new InvalidArgumentException('A public key can only have a single private key (as of 2.0.0)');
            }

            $entries[] = [
                'publicKey'  => $publicKey,
                'privateKey' => $privateKey,
                'acl' => [[
                    'resources' => Resource::getReadWriteResources(),
                    'users' => [$publicKey]
                ]]
            ];
        }

        return $entries;
    }
590211
protected function buildAssignmentFilterString($accessType, $filterEntities)
    {
        $peIDs = '';
        $filters = [];
        if (count($filterEntities) > 0) {
            foreach ($filterEntities as $ent) {
                $filters[] = $ent->getAccessEntityID();
            }
            $peIDs .= 'and peID in (' . implode($filters, ',') . ')';
        }
        if ($accessType == 0) {
            $accessType = '';
        } else {
            $app = Application::getFacadeApplication();
            $connection = $app->make(Connection::class);
            $accessType = $connection->quote($accessType, PDO::PARAM_INT);
            $accessType = ' and accessType = ' . $accessType;
        }

        return $peIDs . ' ' . $accessType . ' order by accessType desc'; // we order desc so that excludes come last (-1)
    }
491767
public function createPivots($relatedEntities)
    {
        $keys = [];
        $attributes = [];

        $keyName = $this->relatedMap->getKeyName();

        foreach ($relatedEntities as $entity) {
            $keys[] = $entity->getEntityAttribute($keyName);
        }

        $records = $this->createAttachRecords($keys, $attributes);

        $this->query->getQuery()->from($this->table)->insert($records);
    }
1284364
public function findAllWithAccess($permissions)
	{
		return array_filter($this->findAll(), function($user) use ($permissions)
		{
			return $user->hasAccess($permissions);
		});
	}
1032827
public function allocateIdsToEntities(array $entities)
    {
        $this->validateBatch($entities, EntityInterface::class);

        $incompleteKeys = [];
        foreach ($entities as $entity) {
            if ($entity->key()->state() === Key::STATE_INCOMPLETE) {
                $incompleteKeys[] = $entity->key();
            }
        }

        if (!empty($incompleteKeys)) {
            $keys = $this->allocateIds($incompleteKeys);
        }

        return $entities;
    }