コード例 #1
0
ファイル: TeamspeakTransfer.php プロジェクト: orloc/seat
 protected function getValidCorps($users)
 {
     $validCorps = [];
     $invalid = [];
     foreach ($users as $u) {
         $valid_keys = \SeatKey::where('user_id', $u->id)->lists('keyID');
         if (!empty($valid_keys)) {
             $corporation_affiliation = \EveAccountAPIKeyInfoCharacters::whereIn('keyID', $valid_keys)->groupBy('corporationID')->lists('corporationID');
             if (!empty($corporation_affiliation)) {
                 $viable = \EveCorporationCorporationSheet::whereIn('corporationID', $corporation_affiliation)->lists('corporationName');
                 if (!empty($viable)) {
                     $validCorps[] = ['corps' => $viable, 'user' => $u, 'user_groups' => \Auth::getUserGroups($u)];
                 }
             }
         } else {
             $invalid[] = $u;
         }
     }
     return [$validCorps, $invalid];
 }
コード例 #2
0
ファイル: BaseNotify.php プロジェクト: boweiliu/seat
 public static function canAccessCorp($userID, $corpID)
 {
     // Get the SeAT user based on the userID
     $user = \Auth::findUserById($userID);
     // Determine the keys that the user owns
     $valid_keys = \SeatKey::where('user_id', $user->id)->lists('keyID');
     // Check if we have received any keys in the
     // previous query
     if (!empty($valid_keys)) {
         // Get a list of the corporationID's that the
         // user is affaliated with
         $corporation_affiliation = \EveAccountAPIKeyInfoCharacters::whereIn('keyID', $valid_keys)->groupBy('corporationID')->lists('corporationID');
         // With the affiliations known, loop over them
         // matching the affaliated corporationID with
         // the corporationID in question
         foreach ($corporation_affiliation as $affiliation) {
             // If we have a match, return true
             if ($affiliation == $corpID) {
                 return true;
             }
         }
     }
     return false;
 }
コード例 #3
0
ファイル: filters.php プロジェクト: boweiliu/seat
    // We can check if the user is authed and if so, get the keyID's
    // this user is valid for.
    // We will also get a list of corporation ID's that the user is
    // affiliated to. This can be used to check the permissions then
    // later for specific functions such as starbases etc.
    // We will also check if the user has any director roles in any
    // of the affiliated corporations. Directors will be allowed to
    // assign permissions to other members of their corporation
    if (\Auth::check()) {
        // Valid API Keys
        $valid_keys = SeatKey::where('user_id', \Auth::User()->id)->lists('keyID');
        Session::put('valid_keys', $valid_keys);
        // Affiliated corporationID's.
        if (!empty($valid_keys)) {
            // Get the list of corporationID's that the user is affiliated with
            $corporation_affiliation = EveAccountAPIKeyInfoCharacters::whereIn('keyID', $valid_keys)->groupBy('corporationID')->lists('corporationID');
            Session::put('corporation_affiliations', $corporation_affiliation);
            // Determine which corporations the user is a director for
            if (!empty($corporation_affiliation)) {
                $is_director = EveCorporationMemberSecurityRoles::whereIn('corporationID', $corporation_affiliation)->where('roleID', '=', '1')->groupBy('corporationID')->lists('corporationID');
                Session::put('is_director', $is_director);
            }
        } else {
            // Just to ensure that we dont have some strange errors later, lets
            // define a empty array in the session for corporation_affiliations
            Session::put('corporation_affiliations', array());
            Session::put('is_director', array());
            Session::put('valid_keys', array());
        }
    }
});