src/Repositories/Character/Character.php
public function getCharacterCorporations()
    {

        // TODO : rewrite the method according to the new ACL mechanic

        $user = auth()->user();

        $corporations = ApiKeyInfoCharacters::join(
            'eve_api_keys',
            'eve_api_keys.key_id', '=',
            'account_api_key_info_characters.keyID')
            ->distinct();

        // If the user us a super user, return all
        if (! $user->hasSuperUser()) {

            $corporations = $corporations->orWhere(function ($query) use ($user) {

                // If the user has any affiliations and can
                // list those characters, add them
                if ($user->has('character.list', false))
                    $query = $query->whereIn('characterID',
                        array_keys($user->getAffiliationMap()['char']));

                // Add any characters from owner API keys
                $query->orWhere('eve_api_keys.user_id', $user->id);
            });
        }

        return $corporations->orderBy('corporationName')
            ->pluck('corporationName');
    }
public function getCharacterCorporations()
    {

        // TODO : rewrite the method according to the new ACL mechanic

        $user = auth()->user();

        $corporations = ApiKeyInfoCharacters::join(
            'eve_api_keys',
            'eve_api_keys.key_id', '=',
            'account_api_key_info_characters.keyID')
            ->distinct();

        // If the user us a super user, return all
        if (! $user->hasSuperUser()) {

            $corporations = $corporations->orWhere(function ($query) use ($user) {

                // If the user has any affiliations and can
                // list those characters, add them
                if ($user->has('character.list', false))
                    $query = $query->whereIn('characterID',
                        array_keys($user->getAffiliationMap()['char']));

                // Add any characters from owner API keys
                $query->orWhere('eve_api_keys.user_id', $user->id);
            });
        }

        return $corporations->orderBy('corporationName')
            ->pluck('corporationName');
    }
public function getCharacterCorporations ( ) { // TODO : rewrite the method according to the new ACL mechanic $ user = auth ( ) -> user ( ) ; $ corporations = ApiKeyInfoCharacters :: join ( 'eve_api_keys' , 'eve_api_keys.key_id' , '=' , 'account_api_key_info_characters.keyID' ) -> distinct ( ) ; // If the user us a super user, return all if ( ! $ user -> hasSuperUser ( ) ) { $ corporations = $ corporations -> orWhere ( function ( $ query ) use ( $ user ) { // If the user has any affiliations and can // list those characters, add them if ( $ user -> has ( 'character.list' , false ) ) $ query = $ query -> whereIn ( 'characterID' , array_keys ( $ user -> getAffiliationMap ( ) [ 'char' ] ) ) ; // Add any characters from owner API keys $ query -> orWhere ( 'eve_api_keys.user_id' , $ user -> id ) ; } ) ; } return $ corporations -> orderBy ( 'corporationName' ) -> pluck ( 'corporationName' ) ; }
Get a list of corporations the current
authenticated user has access to.

@deprecated replace by new ACL system. Must be move to ACL trait

@return mixed
Get a list of corporations the current authenticated user has access to .