Пример #1
0
 public static function determineAccess($keyID)
 {
     // Locate the key in the db
     $key = \SeatKey::where('keyID', '=', $keyID)->where('isOk', '=', 1)->first();
     if (!$key) {
         return array();
     }
     // Attempt to get the type & accessMask from the database.
     Account\APIKeyInfo::update($keyID, $key->vCode);
     $key_mask_info = \EveAccountAPIKeyInfo::where('keyID', '=', $keyID)->first();
     // Potential cause for #182. Comment out for now.
     // Account\AccountStatus::update($keyID, $key->vCode);
     // If we still can't determine mask information, leave everything
     if (!$key_mask_info) {
         return array();
     }
     // Prepare a return by setting the 'type' key to the key type we have
     $type = $key_mask_info->type == 'Account' ? 'Character' : $key_mask_info->type;
     $return_access = array('type' => $type);
     // Loop over all the masks we have, and return those we have access to for this key
     foreach (\EveApiCalllist::where('type', '=', $type)->get() as $mask) {
         if ($key_mask_info->accessMask & $mask->accessMask) {
             $return_access['access'][] = array('type' => $mask->type, 'name' => $mask->name);
         }
     }
     // Return it all as a nice array
     return $return_access;
 }
Пример #2
0
 public static function processAccessMask($mask, $type)
 {
     // Prepare the return array
     $return = array();
     // Loop over the call list, populating the array, based on the type
     if ($type == 'Corporation') {
         // Loop over the call list, populating the array
         foreach (\EveApiCalllist::where('type', 'Corporation')->get() as $call) {
             $return[$call->name] = (int) $call->accessMask & (int) $mask ? 'true' : 'false';
         }
     } else {
         // Loop over the call list, populating the array
         foreach (\EveApiCalllist::where('type', 'Character')->get() as $call) {
             $return[$call->name] = (int) $call->accessMask & (int) $mask ? 'true' : 'false';
         }
     }
     // Return the populated array
     return $return;
 }