API form validates by member and characters

Functions to determine membership level of user and eve characters
This commit is contained in:
Adarnof
2015-12-11 12:50:30 +00:00
parent d20c73fb03
commit d4b9186c61
4 changed files with 150 additions and 32 deletions

View File

@@ -267,3 +267,26 @@ class EveApiManager():
return False
logger.warn("Exception prevented verification of corp id %s existance. Assuming false." % corp_id)
return False
@staticmethod
def validate_member_api(api_id, api_key):
if settings.MEMBER_API_ACCOUNT:
if EveApiManager.check_if_api_is_type_account(api_id, api_key) is not True:
logger.debug("Api id %s is not type account as required for members - failed validation." % api_id)
return False
if EveApiManager.check_api_is_full(api_id, api_key) is not True:
logger.debug("Api id %s does not meet member access mask requirements - failed validation." % api_id)
return False
return True
@staticmethod
def validate_blue_api(api_id, api_key):
if settings.BLUE_API_ACCOUNT:
if EveApiManager.check_if_api_is_type_account(api_id, api_key) is not True:
logger.debug("Api id %s is not type account as required for blues - failed validation." % api_id)
return False
if EveApiManager.check_blue_api_is_full(api_id, api_key) is not True:
logger.debug("Api id %s does not meet minimum blue access mask requirements - failed validation." % api_id)
return False
return True