concrete/src/Permission/Access/Entity/GroupCombinationEntity.php
public static function getAccessEntitiesForUser($user)
    {
        $entities = [];
        // If the user isnt registered, there is no need to do this anymore.
        if ($user->isRegistered()) {
            $ingids = [];
            $app = Facade::getFacadeApplication();
            /** @var $database \Concrete\Core\Database\Connection\Connection */
            $database = $app->make('database')->connection();

            // First look for any combos that this group would specifically be in.
            // We check if the combos contain any of the groups this user is in.
            // That way if there aren't any we can just skip it.
            foreach ($user->getUserGroups() as $key => $val) {
                $ingids[] = $key;
            }
            $instr = implode(',', $ingids);

            $peIDs = $database->fetchAll(
                'select distinct pae.peID from PermissionAccessEntities pae
                inner join PermissionAccessEntityTypes paet on pae.petID = paet.petID
                inner join PermissionAccessEntityGroups paeg on pae.peID = paeg.peID
                where petHandle = \'group_combination\' 
                and paeg.gID in (' . $instr . ')'
            );
            // Now for each one we check to see if it applies here.
            foreach ($peIDs as $peID) {
                $r = $database->fetchAssoc(
                    'select count(gID) as peGroups, 
                    (select count(UserGroups.gID) from UserGroups where uID = ? 
                      and gID in 
                      (select gID from PermissionAccessEntityGroups where peID = ?))
                     as uGroups from PermissionAccessEntityGroups where peID = ?',
                    [$user->getUserID(), $peID['peID'], $peID['peID']]
                );
                if ($r['peGroups'] == $r['uGroups'] && $r['peGroups'] > 1) {
                    $entity = Entity::getByID($peID['peID']);
                    if (is_object($entity)) {
                        $entities[] = $entity;
                    }
                }
            }
        }

        return $entities;
    }
public static function getAccessEntitiesForUser($user)
    {
        $entities = [];
        // If the user isnt registered, there is no need to do this anymore.
        if ($user->isRegistered()) {
            $ingids = [];
            $app = Facade::getFacadeApplication();
            /** @var $database \Concrete\Core\Database\Connection\Connection */
            $database = $app->make('database')->connection();

            // First look for any combos that this group would specifically be in.
            // We check if the combos contain any of the groups this user is in.
            // That way if there aren't any we can just skip it.
            foreach ($user->getUserGroups() as $key => $val) {
                $ingids[] = $key;
            }
            $instr = implode(',', $ingids);

            $peIDs = $database->fetchAll(
                'select distinct pae.peID from PermissionAccessEntities pae
                inner join PermissionAccessEntityTypes paet on pae.petID = paet.petID
                inner join PermissionAccessEntityGroups paeg on pae.peID = paeg.peID
                where petHandle = \'group_combination\' 
                and paeg.gID in (' . $instr . ')'
            );
            // Now for each one we check to see if it applies here.
            foreach ($peIDs as $peID) {
                $r = $database->fetchAssoc(
                    'select count(gID) as peGroups, 
                    (select count(UserGroups.gID) from UserGroups where uID = ? 
                      and gID in 
                      (select gID from PermissionAccessEntityGroups where peID = ?))
                     as uGroups from PermissionAccessEntityGroups where peID = ?',
                    [$user->getUserID(), $peID['peID'], $peID['peID']]
                );
                if ($r['peGroups'] == $r['uGroups'] && $r['peGroups'] > 1) {
                    $entity = Entity::getByID($peID['peID']);
                    if (is_object($entity)) {
                        $entities[] = $entity;
                    }
                }
            }
        }

        return $entities;
    }
public static function getAccessEntitiesForUser ( $ user ) { $ entities = [ ] ; // If the user isnt registered, there is no need to do this anymore. if ( $ user -> isRegistered ( ) ) { $ ingids = [ ] ; $ app = Facade :: getFacadeApplication ( ) ; /** @var $database \Concrete\Core\Database\Connection\Connection */ $ database = $ app -> make ( 'database' ) -> connection ( ) ; // First look for any combos that this group would specifically be in. // We check if the combos contain any of the groups this user is in. // That way if there aren't any we can just skip it. foreach ( $ user -> getUserGroups ( ) as $ key => $ val ) { $ ingids [ ] = $ key ; } $ instr = implode ( ',' , $ ingids ) ; $ peIDs = $ database -> fetchAll ( 'select distinct pae.peID from PermissionAccessEntities pae
                inner join PermissionAccessEntityTypes paet on pae.petID = paet.petID
                inner join PermissionAccessEntityGroups paeg on pae.peID = paeg.peID
                where petHandle = \'group_combination\' 
                and paeg.gID in (' . $ instr . ')' ) ; // Now for each one we check to see if it applies here. foreach ( $ peIDs as $ peID ) { $ r = $ database -> fetchAssoc ( 'select count(gID) as peGroups, 
                    (select count(UserGroups.gID) from UserGroups where uID = ? 
                      and gID in 
                      (select gID from PermissionAccessEntityGroups where peID = ?))
                     as uGroups from PermissionAccessEntityGroups where peID = ?' , [ $ user -> getUserID ( ) , $ peID [ 'peID' ] , $ peID [ 'peID' ] ] ) ; if ( $ r [ 'peGroups' ] == $ r [ 'uGroups' ] && $ r [ 'peGroups' ] > 1 ) { $ entity = Entity :: getByID ( $ peID [ 'peID' ] ) ; if ( is_object ( $ entity ) ) { $ entities [ ] = $ entity ; } } } } return $ entities ; }
Returns all GroupCombination Access Entities for the provided user.

@param \Concrete\Core\User\User | \Concrete\Core\Entity\User\User $user

@return Entity[] | array
Returns all GroupCombination Access Entities for the provided user .