- added character whitelist to pathfinder.ini, closed #611
This commit is contained in:
@@ -32,6 +32,7 @@ class CharacterModel extends BasicModel {
|
||||
const AUTHORIZATION_STATUS = [
|
||||
'OK' => true, // success
|
||||
'UNKNOWN' => 'error', // general authorization error
|
||||
'CHARACTER' => 'failed to match character whitelist',
|
||||
'CORPORATION' => 'failed to match corporation whitelist',
|
||||
'ALLIANCE' => 'failed to match alliance whitelist',
|
||||
'KICKED' => 'character is kicked',
|
||||
@@ -552,25 +553,39 @@ class CharacterModel extends BasicModel {
|
||||
// check whether character is banned or temp kicked
|
||||
if(is_null($this->banned)){
|
||||
if( !$this->isKicked() ){
|
||||
$whitelistCharacter = array_filter( array_map('trim', (array)Config::getPathfinderData('login.character') ) );
|
||||
$whitelistCorporations = array_filter( array_map('trim', (array)Config::getPathfinderData('login.corporation') ) );
|
||||
$whitelistAlliance = array_filter( array_map('trim', (array)Config::getPathfinderData('login.alliance') ) );
|
||||
|
||||
if(
|
||||
empty($whitelistCharacter) &&
|
||||
empty($whitelistCorporations) &&
|
||||
empty($whitelistAlliance)
|
||||
){
|
||||
// no corp/ally restrictions set -> any character is allowed to login
|
||||
$authStatus = 'OK';
|
||||
}else{
|
||||
// check if character is set in whitelist
|
||||
if(
|
||||
!empty($whitelistCharacter) &&
|
||||
in_array((int)$this->_id, $whitelistCharacter)
|
||||
){
|
||||
$authStatus = 'OK';
|
||||
}else{
|
||||
$authStatus = 'CHARACTER';
|
||||
}
|
||||
|
||||
// check if character corporation is set in whitelist
|
||||
if(
|
||||
$authStatus != 'OK' &&
|
||||
!empty($whitelistCorporations) &&
|
||||
$this->hasCorporation() &&
|
||||
in_array((int)$this->get('corporationId', true), $whitelistCorporations)
|
||||
$this->hasCorporation()
|
||||
){
|
||||
$authStatus = 'OK';
|
||||
}else{
|
||||
$authStatus = 'CORPORATION';
|
||||
if( in_array((int)$this->get('corporationId', true), $whitelistCorporations) ){
|
||||
$authStatus = 'OK';
|
||||
}else{
|
||||
$authStatus = 'CORPORATION';
|
||||
}
|
||||
}
|
||||
|
||||
// check if character alliance is set in whitelist
|
||||
|
||||
@@ -32,6 +32,7 @@ COOKIE_EXPIRE = 30
|
||||
MODE_MAINTENANCE = 0
|
||||
|
||||
; restrict login to specific corporations/alliances by id (e.g. 1000166,1000080)
|
||||
CHARACTER =
|
||||
CORPORATION =
|
||||
ALLIANCE =
|
||||
|
||||
|
||||
@@ -616,6 +616,7 @@ define([
|
||||
case 'UNKNOWN':
|
||||
label = 'ERROR';
|
||||
break;
|
||||
case 'CHARACTER':
|
||||
case 'CORPORATION':
|
||||
case 'ALLIANCE':
|
||||
label = 'INVALID';
|
||||
|
||||
@@ -616,6 +616,7 @@ define([
|
||||
case 'UNKNOWN':
|
||||
label = 'ERROR';
|
||||
break;
|
||||
case 'CHARACTER':
|
||||
case 'CORPORATION':
|
||||
case 'ALLIANCE':
|
||||
label = 'INVALID';
|
||||
|
||||
Reference in New Issue
Block a user