From 1770fc55484ef6f965caa415769e7be832aad2cc Mon Sep 17 00:00:00 2001 From: johanko Date: Wed, 6 Apr 2016 13:11:15 +0000 Subject: [PATCH 01/10] Fleetup API manager and views --- alliance_auth/settings.py.example | 498 ------------------ alliance_auth/urls.py | 7 + cache/.gitignore | 0 cache/README.md | 0 fleetup/__init__.py | 0 fleetup/admin.py | 0 fleetup/forms.py | 0 fleetup/models.py | 0 fleetup/tests.py | 0 fleetup/views.py | 101 ++++ log/.gitignore | 0 services/managers/fleetup_manager.py | 118 +++++ stock/templates/public/base.html | 6 + stock/templates/registered/fleetup.html | 221 ++++++++ .../registered/fleetupcharacters.html | 71 +++ .../templates/registered/fleetupdoctrine.html | 94 ++++ .../registered/fleetupdoctrinesview.html | 85 +++ .../templates/registered/fleetupfitting.html | 152 ++++++ .../registered/fleetupfittingsview.html | 78 +++ 19 files changed, 933 insertions(+), 498 deletions(-) delete mode 100755 alliance_auth/settings.py.example mode change 100644 => 100755 cache/.gitignore mode change 100644 => 100755 cache/README.md create mode 100755 fleetup/__init__.py create mode 100755 fleetup/admin.py create mode 100755 fleetup/forms.py create mode 100755 fleetup/models.py create mode 100755 fleetup/tests.py create mode 100755 fleetup/views.py mode change 100644 => 100755 log/.gitignore create mode 100644 services/managers/fleetup_manager.py create mode 100644 stock/templates/registered/fleetup.html create mode 100644 stock/templates/registered/fleetupcharacters.html create mode 100644 stock/templates/registered/fleetupdoctrine.html create mode 100644 stock/templates/registered/fleetupdoctrinesview.html create mode 100644 stock/templates/registered/fleetupfitting.html create mode 100644 stock/templates/registered/fleetupfittingsview.html diff --git a/alliance_auth/settings.py.example b/alliance_auth/settings.py.example deleted file mode 100755 index 4c6de4c6..00000000 --- a/alliance_auth/settings.py.example +++ /dev/null @@ -1,498 +0,0 @@ -""" -vim: set filetype=python: -Django settings for alliance_auth project. - -For more information on this file, see -https://docs.djangoproject.com/en/1.6/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/1.6/ref/settings/ - -""" - -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -import os - -import djcelery - -djcelery.setup_loader() -BASE_DIR = os.path.dirname(os.path.dirname(__file__)) - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -# Generate a new key here: http://www.miniwebtool.com/django-secret-key-generator/ -SECRET_KEY = os.environ.get('AA_SECRET_KEY', '5xvh4e0x&@-$6(kj%4^80pdo1n5v-!mtx(e(1tw@kn-1le*ts@') - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = 'True' == os.environ.get('AA_DEBUG','True') - -TEMPLATE_DEBUG = True - -ALLOWED_HOSTS = ['127.0.0.1','yourdomain.com','www.yourdomain.com'] - -BROKER_URL = 'amqp://guest:guest@localhost:5672/' - -CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler" - -# Application definition -INSTALLED_APPS = ( - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'django.contrib.humanize', - 'django_evolution', - 'djcelery', - 'celerytask', - 'bootstrapform', - 'authentication', - 'portal', - 'registration', - 'services', - 'eveonline', - 'groupmanagement', - 'hrapplications', - 'timerboard', - 'srp', - 'sigtracker', - 'optimer', - 'corputils', - 'notifications', -) - -MIDDLEWARE_CLASSES = ( - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', -) - -ROOT_URLCONF = 'alliance_auth.urls' - -WSGI_APPLICATION = 'alliance_auth.wsgi.application' - -# Database -# https://docs.djangoproject.com/en/1.6/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.mysql', - 'NAME': 'alliance_auth', - 'USER': os.environ.get('AA_DB_DEFAULT_USER', 'allianceserver'), - 'PASSWORD': os.environ.get('AA_DB_DEFAULT_PASSWORD', 'password'), - 'HOST': os.environ.get('AA_DB_DEFAULT_HOST', '127.0.0.1'), - 'PORT': os.environ.get('AA_DB_DEFAULT_PORT', '3306'), - }, - - 'phpbb3': { - 'ENGINE': 'django.db.backends.mysql', - 'NAME': 'alliance_forum', - 'USER': os.environ.get('AA_DB_PHPBB3_USER', 'allianceserver'), - 'PASSWORD': os.environ.get('AA_DB_PHPBB3_PASSWORD', 'password'), - 'HOST': os.environ.get('AA_DB_PHPBB3_HOST', '127.0.0.1'), - 'PORT': os.environ.get('AA_DB_PHPBB3_PORT', '3306'), - }, - - 'ips4': { - 'ENGINE': 'django.db.backends.mysql', - 'NAME': 'alliance_ips4', - 'USER': os.environ.get('AA_DB_IPS4_USER', 'allianceserver'), - 'PASSWORD': os.environ.get('AA_DB_IPS4_PASSWORD', 'password'), - 'HOST': os.environ.get('AA_DB_IPS4_HOST', '127.0.0.1'), - 'PORT': os.environ.get('AA_DB_IPS4_PORT', '3306'), - } - -} - -TEMPLATE_CONTEXT_PROCESSORS = ( - 'django.contrib.auth.context_processors.auth', - 'django.core.context_processors.debug', - 'django.core.context_processors.i18n', - 'django.core.context_processors.media', - 'django.core.context_processors.static', - 'django.core.context_processors.tz', - 'django.contrib.messages.context_processors.messages', - 'django.core.context_processors.request', - 'util.context_processors.is_corp', - 'util.context_processors.corp_id', - 'util.context_processors.corp_name', - 'util.context_processors.alliance_id', - 'util.context_processors.alliance_name', - 'util.context_processors.jabber_url', - 'util.context_processors.domain_url', - 'util.context_processors.member_api_mask', - 'util.context_processors.blue_api_mask', - 'notifications.context_processors.user_notification_count', -) - -TEMPLATE_DIRS = ( - os.path.join(BASE_DIR, 'customization/templates'), - os.path.join(BASE_DIR, 'stock/templates'), -) - -STATICFILES_DIRS = ( - os.path.join(BASE_DIR, "customization/static"), - os.path.join(BASE_DIR, "stock/static"), -) - -LOGIN_URL = '/login_user/' - -# Internationalization -# https://docs.djangoproject.com/en/1.6/topics/i18n/ - -LANGUAGE_CODE = os.environ.get('AA_LANGUAGE_CODE', 'en-us') - -TIME_ZONE = os.environ.get('AA_TIME_ZONE', 'UTC') - -USE_I18N = True - -USE_L10N = True - -USE_TZ = True - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/1.6/howto/static-files/ -STATIC_URL = '/static/' -STATIC_ROOT = '/home/allianceserver/allianceauth/static/' - -# Cache directory for EveWho, no ending / -# by default this becomes ~//alliance_auth/cache -# This directory needs to be writable by the webserver -EVEWHO_CACHE_DIR = '{}/cache'.format(BASE_DIR) - - -##################################################### -## -## Auth configuration starts here -## -##################################################### - -########################### -# ALLIANCE / CORP TOGGLE -########################### -# Specifies to run membership checks against corp or alliance -# Set to FALSE for alliance -# Set to TRUE for corp -########################### -IS_CORP = 'True' == os.environ.get('AA_IS_CORP', 'True') - - -################# -# EMAIL SETTINGS -################# -# DOMAIN - The alliance auth domain_url -# EMAIL_HOST - SMTP Server URL -# EMAIL_PORT - SMTP Server PORT -# EMAIL_HOST_USER - Email Username (for gmail, the entire address) -# EMAIL_HOST_PASSWORD - Email Password -# EMAIL_USE_TLS - Set to use TLS encryption -################# -DOMAIN = os.environ.get('AA_DOMAIN', 'https://yourdomain.com') -EMAIL_HOST = os.environ.get('AA_EMAIL_HOST', 'smtp.gmail.com') -EMAIL_PORT = int(os.environ.get('AA_EMAIL_PORT', '587')) -EMAIL_HOST_USER = os.environ.get('AA_EMAIL_HOST_USER', '') -EMAIL_HOST_PASSWORD = os.environ.get('AA_EMAIL_HOST_PASSWORD', '') -EMAIL_USE_TLS = 'True' == os.environ.get('AA_EMAIL_USE_TLS', 'True') - -#################### -# Front Page Links -#################### -# KILLBOARD_URL - URL for your killboard. Blank to hide link -# MEDIA_URL - URL for your media page (youtube etc). Blank to hide link -# FORUM_URL - URL for your forums. Blank to hide link -#################### -KILLBOARD_URL = os.environ.get('AA_KILLBOARD_URL', '') -EXTERNAL_MEDIA_URL = os.environ.get('AA_EXTERNAL_MEDIA_URL', '') -FORUM_URL = os.environ.get('AA_FORUM_URL', '') - -######################### -# Default Group Settings -######################### -# DEFAULT_AUTH_GROUP - Default group members are put in -# DEFAULT_BLUE_GROUP - Default group for blue members -# MEMBER_CORP_GROUPS - Assign members to a group representing their main corp -# BLUE_CORP_GROUPS - Assign blues to a group representing their main corp -######################### -DEFAULT_AUTH_GROUP = os.environ.get('AA_DEFAULT_ALLIANCE_GROUP', 'Member') -DEFAULT_BLUE_GROUP = os.environ.get('AA_DEFAULT_BLUE_GROUP', 'Blue') -MEMBER_CORP_GROUPS = 'True' == os.environ.get('AA_MEMBER_CORP_GROUPS', 'True') -MEMBER_ALLIANCE_GROUPS = 'True' == os.environ.get('AA_MEMBER_ALLIANCE_GROUPS', 'False') -BLUE_CORP_GROUPS = 'True' == os.environ.get('AA_BLUE_CORP_GROUPS', 'False') -BLUE_ALLIANCE_GROUPS = 'True' == os.environ.get('AA_BLUE_ALLIANCE_GROUPS', 'False') - -######################### -# Alliance Service Setup -######################### -# ENABLE_AUTH_FORUM - Enable forum support in the auth for auth'd members -# ENABLE_AUTH_JABBER - Enable jabber support in the auth for auth'd members -# ENABLE_AUTH_MUMBLE - Enable mumble support in the auth for auth'd members -# ENABLE_AUTH_IPBOARD - Enable IPBoard forum support in the auth for auth'd members -# ENABLE_AUTH_DISCORD - Enable Discord support in the auth for auth'd members -# ENABLE_AUTH_IPS4 - Enable IPS4 support in the auth for auth'd members -######################### -ENABLE_AUTH_FORUM = 'True' == os.environ.get('AA_ENABLE_AUTH_FORUM', 'False') -ENABLE_AUTH_JABBER = 'True' == os.environ.get('AA_ENABLE_AUTH_JABBER', 'False') -ENABLE_AUTH_MUMBLE = 'True' == os.environ.get('AA_ENABLE_AUTH_MUMBLE', 'False') -ENABLE_AUTH_IPBOARD = 'True' == os.environ.get('AA_ENABLE_AUTH_IPBOARD', 'False') -ENABLE_AUTH_TEAMSPEAK3 = 'True' == os.environ.get('AA_ENABLE_AUTH_TEAMSPEAK3', 'False') -ENABLE_AUTH_DISCORD = 'True' == os.environ.get('AA_ENABLE_AUTH_DISCORD', 'False') -ENABLE_AUTH_IPS4 = 'True' == os.environ.get('AA_ENABLE_AUTH_IPS4', 'False') - -##################### -# Blue service Setup -##################### -# BLUE_STANDING - The default lowest standings setting to consider blue -# ENABLE_BLUE_FORUM - Enable forum support in the auth for blues -# ENABLE_BLUE_JABBER - Enable jabber support in the auth for blues -# ENABLE_BLUE_MUMBLE - Enable mumble support in the auth for blues -# ENABLE_BLUE_IPBOARD - Enable IPBoard forum support in the auth for blues -# ENABLE_BLUE_DISCORD - Enable Discord support in the auth for blues -# ENABLE_BLUE_IPS4 - Enable IPS4 support in the auth for blues -##################### -BLUE_STANDING = float(os.environ.get('AA_BLUE_STANDING', '5.0')) -ENABLE_BLUE_FORUM = 'True' == os.environ.get('AA_ENABLE_BLUE_FORUM', 'False') -ENABLE_BLUE_JABBER = 'True' == os.environ.get('AA_ENABLE_BLUE_JABBER', 'False') -ENABLE_BLUE_MUMBLE = 'True' == os.environ.get('AA_ENABLE_BLUE_MUMBLE', 'False') -ENABLE_BLUE_IPBOARD = 'True' == os.environ.get('AA_ENABLE_BLUE_IPBOARD', 'False') -ENABLE_BLUE_TEAMSPEAK3 = 'True' == os.environ.get('AA_ENABLE_BLUE_TEAMSPEAK3', 'False') -ENABLE_BLUE_DISCORD = 'True' == os.environ.get('AA_ENABLE_BLUE_DISCORD', 'False') -ENABLE_BLUE_IPS4 = 'True' == os.environ.get('AA_ENABLE_BLUE_IPS4', 'False') - -######################### -# Corp Configuration -######################### -# If running in alliance mode, the following should be for the executor corp# -# CORP_ID - Set this to your corp ID (get this from https://zkillboard.com/corporation/#######) -# CORP_NAME - Set this to your Corporation Name -# CORP_API_ID - Set this to the api id for the corp API key -# CORP_API_VCODE - Set this to the api vcode for the corp API key -######################## -CORP_ID = os.environ.get('AA_CORP_ID', '') -CORP_NAME = os.environ.get('AA_CORP_NAME', '') -CORP_API_ID = os.environ.get('AA_CORP_API_ID', '') -CORP_API_VCODE = os.environ.get('AA_CORP_API_VCODE', '') - -######################### -# Alliance Configuration -######################### -# ALLIANCE_ID - Set this to your Alliance ID (get this from https://zkillboard.com/alliance/#######) -# ALLIANCE_NAME - Set this to your Alliance Name -######################## -ALLIANCE_ID = os.environ.get('AA_ALLIANCE_ID', '') -ALLIANCE_NAME = os.environ.get('AA_ALLIANCE_NAME', '') - -######################## -# API Configuration -######################## -# MEMBER_API_MASK - Numeric value of minimum API mask required for members -# MEMBER_API_ACCOUNT - Require API to be for Account and not character restricted -# BLUE_API_MASK - Numeric value of minimum API mask required for blues -# BLUE_API_ACCOUNT - Require API to be for Account and not character restricted -####################### -MEMBER_API_MASK = os.environ.get('AA_MEMBER_API_MASK', 268435455) -MEMBER_API_ACCOUNT = 'True' == os.environ.get('AA_MEMBER_API_ACCOUNT', 'True') -BLUE_API_MASK = os.environ.get('AA_BLUE_API_MASK', 8388608) -BLUE_API_ACCOUNT = 'True' == os.environ.get('AA_BLUE_API_ACCOUNT', 'False') - -##################### -# HR Configuration -##################### -# JACK_KNIFE_URL - Url for the audit page of API Jack knife -# Should seriously replace with your own. -##################### -JACK_KNIFE_URL = os.environ.get('AA_JACK_KNIFE_URL', 'http://ridetheclown.com/eveapi/audit.php') - -##################### -# Forum Configuration -##################### -# IPBOARD_ENDPOINT - Api endpoint if using ipboard -# IPBOARD_APIKEY - Api key to interact with ipboard -# IPBOARD_APIMODULE - Module for alliance auth *leave alone* -##################### -IPBOARD_ENDPOINT = os.environ.get('AA_IPBOARD_ENDPOINT', 'yourdomain.com/interface/board/index.php') -IPBOARD_APIKEY = os.environ.get('AA_IPBOARD_APIKEY', 'somekeyhere') -IPBOARD_APIMODULE = 'aa' - -###################### -# Jabber Configuration -###################### -# JABBER_URL - Jabber address url -# JABBER_PORT - Jabber service portal -# JABBER_SERVER - Jabber server url -# OPENFIRE_ADDRESS - Address of the openfire admin console including port -# Please use http with 9090 or https with 9091 -# OPENFIRE_SECRET_KEY - Openfire REST API secret key -# BROADCAST_USER - Broadcast user JID -# BROADCAST_USER_PASSWORD - Broadcast user password -###################### -JABBER_URL = os.environ.get('AA_JABBER_URL', "yourdomain.com") -JABBER_PORT = int(os.environ.get('AA_JABBER_PORT', '5223')) -JABBER_SERVER = os.environ.get('AA_JABBER_SERVER', "yourdomain.com") -OPENFIRE_ADDRESS = os.environ.get('AA_OPENFIRE_ADDRESS', "http://yourdomain.com:9090") -OPENFIRE_SECRET_KEY = os.environ.get('AA_OPENFIRE_SECRET_KEY', "somekey") -BROADCAST_USER = os.environ.get('AA_BROADCAST_USER', "broadcast@") + JABBER_URL -BROADCAST_USER_PASSWORD = os.environ.get('AA_BROADCAST_USER_PASSWORD', "somepassword") -BROADCAST_SERVICE_NAME = os.environ.get('AA_BROADCAST_SERVICE_NAME', "broadcast") - -###################################### -# Mumble Configuration -###################################### -# MUMBLE_URL - Mumble server url -# MUMBLE_SERVER_ID - Mumble server id -###################################### -MUMBLE_URL = os.environ.get('AA_MUMBLE_URL', "yourdomain.com") -MUMBLE_SERVER_ID = int(os.environ.get('AA_MUMBLE_SERVER_ID', '1')) - -###################################### -# Teamspeak3 Configuration -###################################### -# TEAMSPEAK3_SERVER_IP - Teamspeak3 server ip -# TEAMSPEAK3_SERVER_PORT - Teamspeak3 server port -# TEAMSPEAK3_SERVERQUERY_USER - Teamspeak3 serverquery username -# TEAMSPEAK3_SERVERQUERY_PASSWORD - Teamspeak3 serverquery password -# TEAMSPEAK3_VIRTUAL_SERVER - Virtual server id -# TEAMSPEAK3_AUTHED_GROUP_ID - Default authed group id -# TEAMSPEAK3_PUBLIC_URL - teamspeak3 public url used for link creation -###################################### -TEAMSPEAK3_SERVER_IP = os.environ.get('AA_TEAMSPEAK3_SERVER_IP', '127.0.0.1') -TEAMSPEAK3_SERVER_PORT = int(os.environ.get('AA_TEAMSPEAK3_SERVER_PORT', '10011')) -TEAMSPEAK3_SERVERQUERY_USER = os.environ.get('AA_TEAMSPEAK3_SERVERQUERY_USER', 'serveradmin') -TEAMSPEAK3_SERVERQUERY_PASSWORD = os.environ.get('AA_TEAMSPEAK3_SERVERQUERY_PASSWORD', 'passwordhere') -TEAMSPEAK3_VIRTUAL_SERVER = int(os.environ.get('AA_TEAMSPEAK3_VIRTUAL_SERVER', '1')) -TEAMSPEAK3_PUBLIC_URL = os.environ.get('AA_TEAMSPEAK3_PUBLIC_URL', 'yourdomain.com') - -###################################### -# Discord Configuration -###################################### -# DISCORD_SERVER_ID - ID of the server to manage -# DISCORD_USER_EMAIL - email of the server management user -# DISCORD_USER_PASSWORD - password of the server management user -###################################### -DISCORD_SERVER_ID = os.environ.get('AA_DISCORD_SERVER_ID', '') -DISCORD_USER_EMAIL = os.environ.get('AA_DISCORD_USER_EMAIL', '') -DISCORD_USER_PASSWORD = os.environ.get('AA_DISCORD_USER_PASSWORD', '') - -##################################### -# IPS4 Configuration -##################################### -# IPS4_URL - base url of the IPS4 install (no trailing slash) -# IPS4_API_KEY - API key provided by IPS4 -##################################### -IPS4_URL = os.environ.get('AA_IPS4_URL', 'http://yourdomain.com/ips4') -IPS4_API_KEY = os.environ.get('AA_IPS4_API_KEY', '') - -##################################### -# Logging Configuration -##################################### -# Set log_file and console level to desired state: -# DEBUG - basically stack trace, explains every step -# INFO - model creation, deletion, updates, etc -# WARN - unexpected function outcomes that do not impact user -# ERROR - unexcpeted function outcomes which prevent user from achieving desired outcome -# EXCEPTION - something critical went wrong, unhandled -##################################### -# Recommended level for log_file is INFO, console is DEBUG -# Change log level of individual apps below to narrow your debugging -##################################### -LOGGING = { - 'version': 1, - 'disable_existing_loggers': False, - 'formatters': { - 'verbose': { - 'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", - 'datefmt' : "%d/%b/%Y %H:%M:%S" - }, - 'simple': { - 'format': '%(levelname)s %(message)s' - }, - }, - 'handlers': { - 'log_file': { - 'level': 'INFO', # edit this line to change logging level to file - 'class': 'logging.handlers.RotatingFileHandler', - 'filename': os.path.join(BASE_DIR,'log/allianceauth.log'), - 'formatter': 'verbose', - 'maxBytes': 1024*1024*5, # edit this line to change max log file size - 'backupCount': 5, # edit this line to change number of log backups - }, - 'console': { - 'level': 'DEBUG', # edit this line to change logging level to console - 'class': 'logging.StreamHandler', - 'formatter': 'verbose', - }, - 'notifications': { # creates notifications for users with logging_notifications permission - 'level': 'ERROR', # edit this line to change logging level to notifications - 'class': 'notifications.handlers.NotificationHandler', - 'formatter': 'verbose', - }, - }, - 'loggers': { - 'authentication': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'celerytask': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'eveonline': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'groupmanagement': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'hrapplications': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'portal': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'registration': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'services': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'srp': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'timerboard': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'sigtracker': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'optimer': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'corputils': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'util': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'django': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'ERROR', - }, - } -} - diff --git a/alliance_auth/urls.py b/alliance_auth/urls.py index 52b2c157..1e62b602 100755 --- a/alliance_auth/urls.py +++ b/alliance_auth/urls.py @@ -186,6 +186,13 @@ urlpatterns = patterns('', # FLEET FITTINGS url(r'^fits/$', 'services.views.fleet_fits', name='auth_fleet_fits'), + #Fleetup + url(r'^fleetup/$', 'fleetup.views.fleetup_view', name='auth_fleetup_view'), + url(r'^fleetup/fittings/$', 'fleetup.views.fleetup_fittings', name='auth_fleetup_fittings'), + url(r'^fleetup/fittings/(?P[0-9]+)/$', 'fleetup.views.fleetup_fitting'), + url(r'^fleetup/doctrines/$', 'fleetup.views.fleetup_doctrines', name='auth_fleetup_doctrines'), + url(r'^fleetup/characters/$', 'fleetup.views.fleetup_characters', name='auth_fleetup_characters'), + url(r'^fleetup/doctrines/(?P[0-9]+)/$', 'fleetup.views.fleetup_doctrine'), # Sig Tracker url(r'^sigtracker/$', 'sigtracker.views.sigtracker_view', name='auth_signature_view'), diff --git a/cache/.gitignore b/cache/.gitignore old mode 100644 new mode 100755 diff --git a/cache/README.md b/cache/README.md old mode 100644 new mode 100755 diff --git a/fleetup/__init__.py b/fleetup/__init__.py new file mode 100755 index 00000000..e69de29b diff --git a/fleetup/admin.py b/fleetup/admin.py new file mode 100755 index 00000000..e69de29b diff --git a/fleetup/forms.py b/fleetup/forms.py new file mode 100755 index 00000000..e69de29b diff --git a/fleetup/models.py b/fleetup/models.py new file mode 100755 index 00000000..e69de29b diff --git a/fleetup/tests.py b/fleetup/tests.py new file mode 100755 index 00000000..e69de29b diff --git a/fleetup/views.py b/fleetup/views.py new file mode 100755 index 00000000..1595c244 --- /dev/null +++ b/fleetup/views.py @@ -0,0 +1,101 @@ +import datetime +from operator import itemgetter, attrgetter, methodcaller + +from django.utils.timezone import utc + +from django.conf import settings +from django.shortcuts import render_to_response +from django.template import RequestContext +from django.contrib.auth.decorators import login_required +from django.contrib.auth.decorators import permission_required +from django.contrib.auth.decorators import user_passes_test +from django.shortcuts import HttpResponseRedirect +from django.template.defaulttags import register +from django.contrib.humanize.templatetags.humanize import intword + +from collections import namedtuple + +from authentication.managers import AuthServicesInfoManager +from util import check_if_user_has_permission +from services.managers.eve_api_manager import EveApiManager +from services.managers.fleetup_manager import FleetUpManager +from eveonline.models import EveCorporationInfo +from eveonline.models import EveAllianceInfo +from eveonline.models import EveCharacter +from authentication.models import AuthServicesInfo + +import logging + +logger = logging.getLogger(__name__) + +@register.filter +def get_item(dictionary, key): + return dictionary.get(key) + +def fleetup_util_test(user): + return check_if_user_has_permission(user, 'member') or check_if_user_has_permission(user, 'blue_member') + +@login_required +@user_passes_test(fleetup_util_test) +def fleetup_view(request): + logger.debug("fleetup_view called by user %s" % request.user) + + operations_list = FleetUpManager.get_fleetup_operations() + timers_list = FleetUpManager.get_fleetup_timers() + now = datetime.datetime.now().strftime('%H:%M:%S') + + context = {"timers_list": sorted(timers_list.items()), + "operations_list": sorted(operations_list.items()), + "now": now} + + return render_to_response('registered/fleetup.html',context, context_instance=RequestContext(request) ) + +@login_required +@permission_required('auth.corp_stats') +def fleetup_characters(request): + logger.debug("fleetup_characters called by user %s" % request.user) + + member_list = FleetUpManager.get_fleetup_members() + + context = {"member_list": sorted(member_list.items())} + + return render_to_response('registered/fleetupcharacters.html',context, context_instance=RequestContext(request) ) + +@login_required +@user_passes_test(fleetup_util_test) +def fleetup_fittings(request): + logger.debug("fleetup_fittings called by user %s" % request.user) + fitting_list = FleetUpManager.get_fleetup_fittings() + context = {"fitting_list": sorted(fitting_list.items())} + return render_to_response('registered/fleetupfittingsview.html',context, context_instance=RequestContext(request) ) + +@login_required +@user_passes_test(fleetup_util_test) +def fleetup_fitting(request, fittingnumber): + logger.debug("fleetup_fitting called by user %s" % request.user) + fitting_eft = FleetUpManager.get_fleetup_fitting_eft(fittingnumber) + fitting_data = FleetUpManager.get_fleetup_fitting(fittingnumber) + doctrinenumber = FleetUpManager.get_fleetup_doctrineid(fittingnumber) + doctrines_list = FleetUpManager.get_fleetup_doctrine(doctrinenumber) + context = {"fitting_eft": fitting_eft, + "fitting_data": fitting_data, + "doctrines_list": doctrines_list} + return render_to_response('registered/fleetupfitting.html',context, context_instance=RequestContext(request) ) + + +@login_required +@user_passes_test(fleetup_util_test) +def fleetup_doctrines(request): + logger.debug("fleetup_doctrines called by user %s" % request.user) + doctrines_list = FleetUpManager.get_fleetup_doctrines() + context = {"doctrines_list": doctrines_list} + return render_to_response('registered/fleetupdoctrinesview.html',context, context_instance=RequestContext(request) ) + +@login_required +@user_passes_test(fleetup_util_test) +def fleetup_doctrine(request, doctrinenumber): + logger.debug("fleetup_doctrine called by user %s" % request.user) + doctrine = FleetUpManager.get_fleetup_doctrine(doctrinenumber) + context = {"doctrine": doctrine} + return render_to_response('registered/fleetupdoctrine.html',context, context_instance=RequestContext(request) ) + diff --git a/log/.gitignore b/log/.gitignore old mode 100644 new mode 100755 diff --git a/services/managers/fleetup_manager.py b/services/managers/fleetup_manager.py new file mode 100644 index 00000000..c86c11c3 --- /dev/null +++ b/services/managers/fleetup_manager.py @@ -0,0 +1,118 @@ +from django.conf import settings +from datetime import datetime + +import logging +import requests +import json + +appkey = settings.FLEETUP_APP_KEY +userid = settings.FLEETUP_USER_ID +apiid = settings.FLEETUP_API_ID +groupid = settings.FLEETUP_GROUP_ID + +class FleetUpManager(): + def __init__(self): + pass + + @staticmethod + def get_fleetup_members(): + url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/GroupCharacters/" + str(groupid) + "" + jsondata = requests.get(url).content + fmembers=json.loads(jsondata.decode()) + + #return(fmembers) + return {row["UserId"]:{"user_id":row["UserId"], + "char_name":row["EveCharName"], + "char_id":row["EveCharId"], + "corporation":row["Corporation"]} for row in fmembers["Data"]} + + @staticmethod + def get_fleetup_operations(): + url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/Operations/" + str(groupid) + "" + try: + jsondata = requests.get(url).content + except requests.exceptions.ConnectionError: + r.status_code = "Connection timeout" + foperations=json.loads(jsondata.decode()) + + return {row["StartString"]:{"subject":row["Subject"], + "start": (datetime.strptime(row["StartString"], "%Y-%m-%d %H:%M:%S")), + "end": (datetime.strptime(row["EndString"], "%Y-%m-%d %H:%M:%S")), + "operation_id":row["OperationId"], + "location":row["Location"], + "location_info":row["LocationInfo"], + "details":row["Details"], + "url":row["Url"], + "doctrine":row["Doctrines"], + "organizer":row["Organizer"]} for row in foperations["Data"]} + + @staticmethod + def get_fleetup_timers(): + url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/Timers/" + str(groupid) + "" + jsondata = requests.get(url).content + ftimers=json.loads(jsondata.decode()) + + return {row["ExpiresString"]:{"solarsystem":row["SolarSystem"], + "planet":row["Planet"], + "moon":row["Moon"], + "owner":row["Owner"], + "type":row["Type"], + "timer_type":row["TimerType"], + "expires": (datetime.strptime(row["ExpiresString"], "%Y-%m-%d %H:%M:%S")), + "notes":row["Notes"]} for row in ftimers["Data"]} + + @staticmethod + def get_fleetup_doctrines(): + url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/Doctrines/" + str(groupid) + "" + jsondata = requests.get(url).content + fdoctrines=json.loads(jsondata.decode()) + + return {"fleetup_doctrines":fdoctrines["Data"]} + + @staticmethod + def get_fleetup_doctrine(doctrinenumber): + url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/%s" % doctrinenumber + jsondata = requests.get(url).content + fdoctrine=json.loads(jsondata.decode()) + + return {"fitting_doctrine":fdoctrine} + + @staticmethod + def get_fleetup_fittings(): + url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/Fittings/" + str(groupid) + "" + jsondata = requests.get(url).content + ffittings=json.loads(jsondata.decode()) + + return {row["FittingId"]:{"fitting_id":row["FittingId"], + "name":row["Name"], + "icon_id":row["EveTypeId"], + "hull":row["HullType"], + "shiptype":row["ShipType"], + "estimated":row["EstPrice"], + "faction":row["Faction"], + "categories":row["Categories"], + "last_update":(datetime.strptime(row["LastUpdatedString"], "%Y-%m-%d %H:%M:%S"))} for row in ffittings["Data"]} + + @staticmethod + def get_fleetup_fitting(fittingnumber): + url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/Fitting/%s" % fittingnumber + jsondata = requests.get(url).content + ffitting=json.loads(jsondata.decode()) + + return {"fitting_data":ffitting["Data"]} + + @staticmethod + def get_fleetup_doctrineid(fittingnumber): + url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/Fitting/%s" % fittingnumber + jsondata = requests.get(url).content + fdoctrineid=json.loads(jsondata.decode()) + + return fdoctrineid['Data']['Doctrines'][0]['DoctrineId'] + + @staticmethod + def get_fleetup_fitting_eft(fittingnumber): + url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/Fitting/%s/eft" % fittingnumber + jsondata = requests.get(url).content + ffittingeft=json.loads(jsondata.decode()) + + return {"fitting_eft":ffittingeft["Data"]["FittingData"]} diff --git a/stock/templates/public/base.html b/stock/templates/public/base.html index bb9ea2d4..5afb5ac6 100755 --- a/stock/templates/public/base.html +++ b/stock/templates/public/base.html @@ -146,6 +146,12 @@ href="{% url 'auth_fleet_fits' %}"> Fleet Doctrines +
  • + Fleet-Up +
  • + {% endif %} {% if perms.auth.member or perms.auth.blue_member %} diff --git a/stock/templates/registered/fleetup.html b/stock/templates/registered/fleetup.html new file mode 100644 index 00000000..c4a5a00b --- /dev/null +++ b/stock/templates/registered/fleetup.html @@ -0,0 +1,221 @@ +{% extends "public/base.html" %} +{% load bootstrap %} +{% load staticfiles %} + +{% block title %}Alliance Auth{% endblock %} +{% block page_title %}FleetUp{% endblock page_title %} + +{% block content %} +
    + +
    + + +
    +
    +
    + {% if operations_list %} + {% for subject, start in operations_list %} +
    +
    +

    {{ start.subject }}

    +
    +
    + + + + + + + + + + + + + + + +
    StartEnd
    {{ start.start|date:"l d M H:i" }} Eve Time{{ start.end|date:"l d M H:i" }} Eve Time
    +

    {{ start.details }}

    + +
    + + + + + + + + + + + + + +
    LocationDoctrineOrganizerURL
    + {{ start.location }} - {{ start.location_info }} Dotlan + + {% if start.doctrine %} + {% for doctrine in start.doctrine %} + + {{ doctrine.Name }} + + {% endfor %} + + {% else %} + TBA + {% endif %} + + {{ start.organizer }} + + {% ifequal start.url "" %} +
    No link
    + {% else %} + External link + {% endifequal %} +
    +
    +
    +
    + {% endfor %} + {% else %} +

    There seems to be no Operations in the near future, go make ISK!

    + {% endif %} +
    +
    +
    +
    +

    Current Eve Time:

    +
    +
    +
    +
    +
    + {% if timers_list %} +
    +
    +

    Timers

    +
    +
    + + {% for notes, type in timers_list %} + + + + + {% endfor %} +
    + {{ type.solarsystem }} + + {{ type.expires|date:"l d M H:i" }} +
    +
    +
    + {% endif %} +
    +
    +
    +
    + {% if timers_list %} +
    +
    +

    Timers

    +
    +
    +
    + + + + + + + + + + + {% for notes, type in timers_list %} + + + + + + + + + + {% endfor %} +
    TypeStructureLocationExpires(EVE-time)OwnerNote
    + {% ifequal type.type "Final" %} + + {{ type.type }}{% else %}{{ type.type }}{% endifequal %} + + {{ type.timer_type }} + + {{ type.solarsystem }} - Planet:{{ type.planet }} Moon:{{ type.moon }} + + {{ type.expires|date:"l d M H:i" }} + + {{ type.owner }} + + {{ type.notes }} +
    +
    +
    +
    + {% else %} +

    There seems to be no Timers in the near future, this does not mean there isn't any!

    + {% endif %} +
    +
    +
    + +
    +
    + + + +{% endblock content %} \ No newline at end of file diff --git a/stock/templates/registered/fleetupcharacters.html b/stock/templates/registered/fleetupcharacters.html new file mode 100644 index 00000000..f5b6a6fa --- /dev/null +++ b/stock/templates/registered/fleetupcharacters.html @@ -0,0 +1,71 @@ +{% extends "public/base.html" %} +{% load bootstrap %} +{% load staticfiles %} + +{% block title %}Alliance Auth{% endblock %} +{% block page_title %}FleetUp{% endblock page_title %} + +{% block content %} +
    +{% if perms.auth.corp_stats %} + +
    +
    +

    Characters registered on Fleet-Up.com

    +
    +
    +
    +
    + + + + + + + + {% for char_name, user_id in member_list %} + + + + + + {% endfor %} +
    CharacterCorporationFleet-Up(id)
    + + +

    {{ user_id.char_name }}

    +
    +

    {{ user_id.corporation }}

    +
    +

    {{ user_id.user_id }}

    +
    +
    +
    +
    +
    +{% endif %} +
    +{% endblock content %} \ No newline at end of file diff --git a/stock/templates/registered/fleetupdoctrine.html b/stock/templates/registered/fleetupdoctrine.html new file mode 100644 index 00000000..b6d0d2e7 --- /dev/null +++ b/stock/templates/registered/fleetupdoctrine.html @@ -0,0 +1,94 @@ +{% extends "public/base.html" %} +{% load bootstrap %} +{% load staticfiles %} + +{% block title %}Alliance Auth{% endblock %} +{% block page_title %}FleetUp - Doctrine{% endblock page_title %} + +{% block content %} +
    + +
    + {% for a, j in doctrine.items %} + {% regroup j.Data|dictsort:"Role" by Role as role_list %} + + {% for Role in role_list %} + +
    +
    +

    {{ Role.grouper }}

    +
    +
    + + + + + + + + + + + + {% for item in Role.list %} + + + + + + + + + + + {% endfor %} + +
    NameRoleHull typeShip typeEstimated ISKCategories
    + + + {{ item.Name }} + + {{ item.Role }} + + {{ item.HullType }} + + {{ item.ShipType }} + + {% load humanize %}{{ item.EstPrice|intword }} + + {% for categories in item.Categories %} + {{ categories }}, + {% endfor %} +
    + +
    +
    + {% endfor %} +
    + {% endfor %} +
    + +{% endblock content %} \ No newline at end of file diff --git a/stock/templates/registered/fleetupdoctrinesview.html b/stock/templates/registered/fleetupdoctrinesview.html new file mode 100644 index 00000000..5544ae9f --- /dev/null +++ b/stock/templates/registered/fleetupdoctrinesview.html @@ -0,0 +1,85 @@ +{% extends "public/base.html" %} +{% load bootstrap %} +{% load staticfiles %} + +{% block title %}Alliance Auth{% endblock %} +{% block page_title %}FleetUp{% endblock page_title %} + +{% block content %} +
    + +
    + {% if doctrines_list %} + {% for a, j in doctrines_list.items %} + {% regroup j|dictsort:"FolderName" by FolderName as folder_list %} + {% for FolderName in folder_list %} +
    +
    +
    +

    {{ FolderName.grouper }}

    +
    +
    + + + + + + + + + {% for item in FolderName.list %} + + + + + + + + {% endfor %} +
    NameDoctrineLast updated
    + + + {{ item.Name }} + + {{ item.FolderName }} + + {{ item.LastUpdatedString }} +
    +
    +
    +
    + {% endfor %} +
    + {% endfor %} + + {% else %} +

    There seems to be no Doctrines in here at the moment!

    + {% endif %} +
    + + +{% endblock content %} \ No newline at end of file diff --git a/stock/templates/registered/fleetupfitting.html b/stock/templates/registered/fleetupfitting.html new file mode 100644 index 00000000..32f462aa --- /dev/null +++ b/stock/templates/registered/fleetupfitting.html @@ -0,0 +1,152 @@ +{% extends "public/base.html" %} +{% load bootstrap %} +{% load staticfiles %} + +{% block title %}Alliance Auth{% endblock %} +{% block page_title %}FleetUp - Doctrine{% endblock page_title %} + +{% block content %} +
    + +
    +
    +
    + {% for x, y in fitting_data.items %} +
    +
    +

    This fit is part of a doctrine

    +
    +
    + {% for doctrin in y.Doctrines %} +

    {{ doctrin.Name }}

    +
    +

    Role in doctrine: {{ doctrin.Role }}

    +
    +
    +

    Priority:

    +
    +
    +
    +
    + {{ doctrin.Priority }}/5 +
    +
    +
    + + {% endfor %} +
    +
    +
    +
    +

    Fit categories

    +
    +
    + {% for category in y.Categories %} + {{ category }} + {% endfor %} +
    +
    + {% endfor %} +
    +
    +

    All fits in this Doctrine

    +
    +
    +
    + {% for arbit, orbit in doctrines_list.items %} + + {% for fitting in orbit.Data %} + + +

    {{ fitting.Name }}

    +

    {{ fitting.Role }} - {{ fitting.ShipType }}

    +
    + {% endfor %} + {% endfor %} +
    +
    +
    +
    +
    +
    +
    + {% for a, j in fitting_data.items %} +

    {{ j.Name }}

    +
    +
    +
    + +
    +
    +

    Hull: {{ j.HullType }}

    +

    Ship: {{ j.ShipType }}

    + {% load humanize %} +

    Estimated price: {{ j.EstPrice|intword }} ISK

    +
    + {% regroup j.FittingData by Slot as fitting_list %} + + + + + + {% for Slot in fitting_list %} + + + + {% for item in Slot.list %} + + + + + {% endfor %} + {% endfor %} +
    {{ Slot.grouper }}
    {{ item.Quantity }}x {{ item.TypeName }}
    +
    + {% endfor %} +
    +
    + +
    +
    +
    +

    EFT/Export

    +
    +
    + {% for data in fitting_eft.items %} + {% autoescape off %} +
    {{ fitting_eft.fitting_eft }}
    + {% endautoescape %} + {% endfor %} +
    +
    +
    +
    +
    +
    + +{% endblock content %} \ No newline at end of file diff --git a/stock/templates/registered/fleetupfittingsview.html b/stock/templates/registered/fleetupfittingsview.html new file mode 100644 index 00000000..14e8d9f7 --- /dev/null +++ b/stock/templates/registered/fleetupfittingsview.html @@ -0,0 +1,78 @@ +{% extends "public/base.html" %} +{% load bootstrap %} +{% load staticfiles %} + +{% block title %}Alliance Auth{% endblock %} +{% block page_title %}FleetUp{% endblock page_title %} + +{% block content %} +
    + +
    + {% if fitting_list %} + + + + + + + + + + {% for id, fittings in fitting_list %} + + + + + + + + + + + {% endfor %} +
    NameHullShip typeEstimated ISKCategories
    + + + {{ fittings.name }} + + {{ fittings.hull }} + + {{ fittings.shiptype }} + + {% load humanize %}{{ fittings.estimated|intword }} + + {% for categories in fittings.categories %} + {{ categories }}, + {% endfor %} +
    + {% else %} +

    There seems to be no Doctrines in here at the moment!

    + {% endif %} +
    +
    + +{% endblock content %} \ No newline at end of file From 6ae79ff82ec4d09609abbeb4b415e0f673c91508 Mon Sep 17 00:00:00 2001 From: johanko Date: Thu, 7 Apr 2016 08:52:54 +0000 Subject: [PATCH 02/10] accidently deleted settings example, also fixed a missing folder in api URL. Keep in mind, this Fleet-up integration has no errorhandling or logging. --- alliance_auth/settings.py.example | 529 +++++++++++++++++++++++++++ services/managers/fleetup_manager.py | 2 +- 2 files changed, 530 insertions(+), 1 deletion(-) create mode 100644 alliance_auth/settings.py.example diff --git a/alliance_auth/settings.py.example b/alliance_auth/settings.py.example new file mode 100644 index 00000000..b1f69627 --- /dev/null +++ b/alliance_auth/settings.py.example @@ -0,0 +1,529 @@ +""" +vim: set filetype=python: +Django settings for alliance_auth project. + +For more information on this file, see +https://docs.djangoproject.com/en/1.6/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.6/ref/settings/ + +""" + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os + +import djcelery + +djcelery.setup_loader() +BASE_DIR = os.path.dirname(os.path.dirname(__file__)) + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +# Generate a new key here: http://www.miniwebtool.com/django-secret-key-generator/ +SECRET_KEY = os.environ.get('AA_SECRET_KEY', '5xvh4e0x&@-$6(kj%4^80pdo1n5v-!mtx(e(1tw@kn-1le*ts@') + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = 'True' == os.environ.get('AA_DEBUG','True') + +TEMPLATE_DEBUG = True + +ALLOWED_HOSTS = ['127.0.0.1','yourdomain.com','www.yourdomain.com'] + +BROKER_URL = 'amqp://guest:guest@localhost:5672/' + +CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler" + +# Application definition +INSTALLED_APPS = ( + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'django.contrib.humanize', + 'django_evolution', + 'djcelery', + 'celerytask', + 'bootstrapform', + 'authentication', + 'portal', + 'registration', + 'services', + 'eveonline', + 'groupmanagement', + 'hrapplications', + 'timerboard', + 'srp', + 'sigtracker', + 'optimer', + 'corputils', + 'notifications', +) + +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +) + +ROOT_URLCONF = 'alliance_auth.urls' + +WSGI_APPLICATION = 'alliance_auth.wsgi.application' + +# Database +# https://docs.djangoproject.com/en/1.6/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'alliance_auth', + 'USER': os.environ.get('AA_DB_DEFAULT_USER', 'allianceserver'), + 'PASSWORD': os.environ.get('AA_DB_DEFAULT_PASSWORD', 'password'), + 'HOST': os.environ.get('AA_DB_DEFAULT_HOST', '127.0.0.1'), + 'PORT': os.environ.get('AA_DB_DEFAULT_PORT', '3306'), + }, + + 'phpbb3': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'alliance_forum', + 'USER': os.environ.get('AA_DB_PHPBB3_USER', 'allianceserver'), + 'PASSWORD': os.environ.get('AA_DB_PHPBB3_PASSWORD', 'password'), + 'HOST': os.environ.get('AA_DB_PHPBB3_HOST', '127.0.0.1'), + 'PORT': os.environ.get('AA_DB_PHPBB3_PORT', '3306'), + }, + + 'ips4': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'alliance_ips4', + 'USER': os.environ.get('AA_DB_IPS4_USER', 'allianceserver'), + 'PASSWORD': os.environ.get('AA_DB_IPS4_PASSWORD', 'password'), + 'HOST': os.environ.get('AA_DB_IPS4_HOST', '127.0.0.1'), + 'PORT': os.environ.get('AA_DB_IPS4_PORT', '3306'), + }, + 'smf': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'alliance_smf', + 'USER': os.environ.get('AA_DB_SMF_USER', 'allianceserver'), + 'PASSWORD': os.environ.get('AA_DB_SMF_PASSWORD', 'password'), + 'HOST': os.environ.get('AA_DB_SMF_HOST', '127.0.0.1'), + 'PORT': os.environ.get('AA_DB_SMF_PORT', '3306'), + } + +} + +TEMPLATE_CONTEXT_PROCESSORS = ( + 'django.contrib.auth.context_processors.auth', + 'django.core.context_processors.debug', + 'django.core.context_processors.i18n', + 'django.core.context_processors.media', + 'django.core.context_processors.static', + 'django.core.context_processors.tz', + 'django.contrib.messages.context_processors.messages', + 'django.core.context_processors.request', + 'util.context_processors.is_corp', + 'util.context_processors.corp_id', + 'util.context_processors.corp_name', + 'util.context_processors.alliance_id', + 'util.context_processors.alliance_name', + 'util.context_processors.jabber_url', + 'util.context_processors.domain_url', + 'util.context_processors.member_api_mask', + 'util.context_processors.blue_api_mask', + 'notifications.context_processors.user_notification_count', +) + +TEMPLATE_DIRS = ( + os.path.join(BASE_DIR, 'customization/templates'), + os.path.join(BASE_DIR, 'stock/templates'), +) + +STATICFILES_DIRS = ( + os.path.join(BASE_DIR, "customization/static"), + os.path.join(BASE_DIR, "stock/static"), +) + +LOGIN_URL = '/login_user/' + +# Internationalization +# https://docs.djangoproject.com/en/1.6/topics/i18n/ + +LANGUAGE_CODE = os.environ.get('AA_LANGUAGE_CODE', 'en-us') + +TIME_ZONE = os.environ.get('AA_TIME_ZONE', 'UTC') + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.6/howto/static-files/ +STATIC_URL = '/static/' +STATIC_ROOT = '/home/allianceserver/allianceauth/static/' + +# Cache directory for EveWho, no ending / +# by default this becomes ~//alliance_auth/cache +# This directory needs to be writable by the webserver +EVEWHO_CACHE_DIR = '{}/cache'.format(BASE_DIR) + +# Cache directory for Fleet-Up, no ending / +# by default this becomes ~//alliance_auth/cache +# This directory needs to be writable by the webserver +FLEETUP_CACHE_DIR = '{}/cache'.format(BASE_DIR) + +##################################################### +## +## Auth configuration starts here +## +##################################################### + +########################### +# ALLIANCE / CORP TOGGLE +########################### +# Specifies to run membership checks against corp or alliance +# Set to FALSE for alliance +# Set to TRUE for corp +########################### +IS_CORP = 'True' == os.environ.get('AA_IS_CORP', 'True') + + +################# +# EMAIL SETTINGS +################# +# DOMAIN - The alliance auth domain_url +# EMAIL_HOST - SMTP Server URL +# EMAIL_PORT - SMTP Server PORT +# EMAIL_HOST_USER - Email Username (for gmail, the entire address) +# EMAIL_HOST_PASSWORD - Email Password +# EMAIL_USE_TLS - Set to use TLS encryption +################# +DOMAIN = os.environ.get('AA_DOMAIN', 'https://yourdomain.com') +EMAIL_HOST = os.environ.get('AA_EMAIL_HOST', 'smtp.gmail.com') +EMAIL_PORT = int(os.environ.get('AA_EMAIL_PORT', '587')) +EMAIL_HOST_USER = os.environ.get('AA_EMAIL_HOST_USER', '') +EMAIL_HOST_PASSWORD = os.environ.get('AA_EMAIL_HOST_PASSWORD', '') +EMAIL_USE_TLS = 'True' == os.environ.get('AA_EMAIL_USE_TLS', 'True') + +#################### +# Front Page Links +#################### +# KILLBOARD_URL - URL for your killboard. Blank to hide link +# MEDIA_URL - URL for your media page (youtube etc). Blank to hide link +# FORUM_URL - URL for your forums. Blank to hide link +# SMF_URL - URL for your SMF forums. +#################### +KILLBOARD_URL = os.environ.get('AA_KILLBOARD_URL', '') +EXTERNAL_MEDIA_URL = os.environ.get('AA_EXTERNAL_MEDIA_URL', '') +FORUM_URL = os.environ.get('AA_FORUM_URL', '') +SMF_URL = os.environ.get('AA_SMF_URL', '') + +######################### +# Default Group Settings +######################### +# DEFAULT_AUTH_GROUP - Default group members are put in +# DEFAULT_BLUE_GROUP - Default group for blue members +# MEMBER_CORP_GROUPS - Assign members to a group representing their main corp +# BLUE_CORP_GROUPS - Assign blues to a group representing their main corp +######################### +DEFAULT_AUTH_GROUP = os.environ.get('AA_DEFAULT_ALLIANCE_GROUP', 'Member') +DEFAULT_BLUE_GROUP = os.environ.get('AA_DEFAULT_BLUE_GROUP', 'Blue') +MEMBER_CORP_GROUPS = 'True' == os.environ.get('AA_MEMBER_CORP_GROUPS', 'True') +MEMBER_ALLIANCE_GROUPS = 'True' == os.environ.get('AA_MEMBER_ALLIANCE_GROUPS', 'False') +BLUE_CORP_GROUPS = 'True' == os.environ.get('AA_BLUE_CORP_GROUPS', 'False') +BLUE_ALLIANCE_GROUPS = 'True' == os.environ.get('AA_BLUE_ALLIANCE_GROUPS', 'False') + +######################### +# Alliance Service Setup +######################### +# ENABLE_AUTH_FORUM - Enable forum support in the auth for auth'd members +# ENABLE_AUTH_JABBER - Enable jabber support in the auth for auth'd members +# ENABLE_AUTH_MUMBLE - Enable mumble support in the auth for auth'd members +# ENABLE_AUTH_IPBOARD - Enable IPBoard forum support in the auth for auth'd members +# ENABLE_AUTH_DISCORD - Enable Discord support in the auth for auth'd members +# ENABLE_AUTH_IPS4 - Enable IPS4 support in the auth for auth'd members +# ENABLE_AUTH_SMF - Enable SMF forum support in the auth for auth'd members +######################### +ENABLE_AUTH_FORUM = 'True' == os.environ.get('AA_ENABLE_AUTH_FORUM', 'False') +ENABLE_AUTH_JABBER = 'True' == os.environ.get('AA_ENABLE_AUTH_JABBER', 'False') +ENABLE_AUTH_MUMBLE = 'True' == os.environ.get('AA_ENABLE_AUTH_MUMBLE', 'False') +ENABLE_AUTH_IPBOARD = 'True' == os.environ.get('AA_ENABLE_AUTH_IPBOARD', 'False') +ENABLE_AUTH_TEAMSPEAK3 = 'True' == os.environ.get('AA_ENABLE_AUTH_TEAMSPEAK3', 'False') +ENABLE_AUTH_DISCORD = 'True' == os.environ.get('AA_ENABLE_AUTH_DISCORD', 'False') +ENABLE_AUTH_IPS4 = 'True' == os.environ.get('AA_ENABLE_AUTH_IPS4', 'False') +ENABLE_AUTH_SMF = 'True' == os.environ.get('AA_ENABLE_AUTH_SMF', 'False') + +##################### +# Blue service Setup +##################### +# BLUE_STANDING - The default lowest standings setting to consider blue +# ENABLE_BLUE_FORUM - Enable forum support in the auth for blues +# ENABLE_BLUE_JABBER - Enable jabber support in the auth for blues +# ENABLE_BLUE_MUMBLE - Enable mumble support in the auth for blues +# ENABLE_BLUE_IPBOARD - Enable IPBoard forum support in the auth for blues +# ENABLE_BLUE_DISCORD - Enable Discord support in the auth for blues +# ENABLE_BLUE_IPS4 - Enable IPS4 forum support in the auth for blues +# ENABLE_BLUE_SMF - Enable SMF forum support in the auth for blues +##################### +BLUE_STANDING = float(os.environ.get('AA_BLUE_STANDING', '5.0')) +ENABLE_BLUE_FORUM = 'True' == os.environ.get('AA_ENABLE_BLUE_FORUM', 'False') +ENABLE_BLUE_JABBER = 'True' == os.environ.get('AA_ENABLE_BLUE_JABBER', 'False') +ENABLE_BLUE_MUMBLE = 'True' == os.environ.get('AA_ENABLE_BLUE_MUMBLE', 'False') +ENABLE_BLUE_IPBOARD = 'True' == os.environ.get('AA_ENABLE_BLUE_IPBOARD', 'False') +ENABLE_BLUE_TEAMSPEAK3 = 'True' == os.environ.get('AA_ENABLE_BLUE_TEAMSPEAK3', 'False') +ENABLE_BLUE_DISCORD = 'True' == os.environ.get('AA_ENABLE_BLUE_DISCORD', 'False') +ENABLE_BLUE_IPS4 = 'True' == os.environ.get('AA_ENABLE_BLUE_IPS4', 'False') +ENABLE_BLUE_SMF = 'True' == os.environ.get('AA_ENABLE_BLUE_SMF', 'False') + +######################### +# Corp Configuration +######################### +# If running in alliance mode, the following should be for the executor corp# +# CORP_ID - Set this to your corp ID (get this from https://zkillboard.com/corporation/#######) +# CORP_NAME - Set this to your Corporation Name +# CORP_API_ID - Set this to the api id for the corp API key +# CORP_API_VCODE - Set this to the api vcode for the corp API key +######################## +CORP_ID = os.environ.get('AA_CORP_ID', '') +CORP_NAME = os.environ.get('AA_CORP_NAME', '') +CORP_API_ID = os.environ.get('AA_CORP_API_ID', '') +CORP_API_VCODE = os.environ.get('AA_CORP_API_VCODE', '') + +######################### +# Alliance Configuration +######################### +# ALLIANCE_ID - Set this to your Alliance ID (get this from https://zkillboard.com/alliance/#######) +# ALLIANCE_NAME - Set this to your Alliance Name +######################## +ALLIANCE_ID = os.environ.get('AA_ALLIANCE_ID', '') +ALLIANCE_NAME = os.environ.get('AA_ALLIANCE_NAME', '') + +######################## +# API Configuration +######################## +# MEMBER_API_MASK - Numeric value of minimum API mask required for members +# MEMBER_API_ACCOUNT - Require API to be for Account and not character restricted +# BLUE_API_MASK - Numeric value of minimum API mask required for blues +# BLUE_API_ACCOUNT - Require API to be for Account and not character restricted +####################### +MEMBER_API_MASK = os.environ.get('AA_MEMBER_API_MASK', 268435455) +MEMBER_API_ACCOUNT = 'True' == os.environ.get('AA_MEMBER_API_ACCOUNT', 'True') +BLUE_API_MASK = os.environ.get('AA_BLUE_API_MASK', 8388608) +BLUE_API_ACCOUNT = 'True' == os.environ.get('AA_BLUE_API_ACCOUNT', 'False') + +##################### +# HR Configuration +##################### +# JACK_KNIFE_URL - Url for the audit page of API Jack knife +# Should seriously replace with your own. +##################### +JACK_KNIFE_URL = os.environ.get('AA_JACK_KNIFE_URL', 'http://ridetheclown.com/eveapi/audit.php') + +##################### +# Forum Configuration +##################### +# IPBOARD_ENDPOINT - Api endpoint if using ipboard +# IPBOARD_APIKEY - Api key to interact with ipboard +# IPBOARD_APIMODULE - Module for alliance auth *leave alone* +##################### +IPBOARD_ENDPOINT = os.environ.get('AA_IPBOARD_ENDPOINT', 'yourdomain.com/interface/board/index.php') +IPBOARD_APIKEY = os.environ.get('AA_IPBOARD_APIKEY', 'somekeyhere') +IPBOARD_APIMODULE = 'aa' + +###################### +# Jabber Configuration +###################### +# JABBER_URL - Jabber address url +# JABBER_PORT - Jabber service portal +# JABBER_SERVER - Jabber server url +# OPENFIRE_ADDRESS - Address of the openfire admin console including port +# Please use http with 9090 or https with 9091 +# OPENFIRE_SECRET_KEY - Openfire REST API secret key +# BROADCAST_USER - Broadcast user JID +# BROADCAST_USER_PASSWORD - Broadcast user password +###################### +JABBER_URL = os.environ.get('AA_JABBER_URL', "yourdomain.com") +JABBER_PORT = int(os.environ.get('AA_JABBER_PORT', '5223')) +JABBER_SERVER = os.environ.get('AA_JABBER_SERVER', "yourdomain.com") +OPENFIRE_ADDRESS = os.environ.get('AA_OPENFIRE_ADDRESS', "http://yourdomain.com:9090") +OPENFIRE_SECRET_KEY = os.environ.get('AA_OPENFIRE_SECRET_KEY', "somekey") +BROADCAST_USER = os.environ.get('AA_BROADCAST_USER', "broadcast@") + JABBER_URL +BROADCAST_USER_PASSWORD = os.environ.get('AA_BROADCAST_USER_PASSWORD', "somepassword") +BROADCAST_SERVICE_NAME = os.environ.get('AA_BROADCAST_SERVICE_NAME', "broadcast") + +###################################### +# Mumble Configuration +###################################### +# MUMBLE_URL - Mumble server url +# MUMBLE_SERVER_ID - Mumble server id +###################################### +MUMBLE_URL = os.environ.get('AA_MUMBLE_URL', "yourdomain.com") +MUMBLE_SERVER_ID = int(os.environ.get('AA_MUMBLE_SERVER_ID', '1')) + +###################################### +# Teamspeak3 Configuration +###################################### +# TEAMSPEAK3_SERVER_IP - Teamspeak3 server ip +# TEAMSPEAK3_SERVER_PORT - Teamspeak3 server port +# TEAMSPEAK3_SERVERQUERY_USER - Teamspeak3 serverquery username +# TEAMSPEAK3_SERVERQUERY_PASSWORD - Teamspeak3 serverquery password +# TEAMSPEAK3_VIRTUAL_SERVER - Virtual server id +# TEAMSPEAK3_AUTHED_GROUP_ID - Default authed group id +# TEAMSPEAK3_PUBLIC_URL - teamspeak3 public url used for link creation +###################################### +TEAMSPEAK3_SERVER_IP = os.environ.get('AA_TEAMSPEAK3_SERVER_IP', '127.0.0.1') +TEAMSPEAK3_SERVER_PORT = int(os.environ.get('AA_TEAMSPEAK3_SERVER_PORT', '10011')) +TEAMSPEAK3_SERVERQUERY_USER = os.environ.get('AA_TEAMSPEAK3_SERVERQUERY_USER', 'serveradmin') +TEAMSPEAK3_SERVERQUERY_PASSWORD = os.environ.get('AA_TEAMSPEAK3_SERVERQUERY_PASSWORD', 'passwordhere') +TEAMSPEAK3_VIRTUAL_SERVER = int(os.environ.get('AA_TEAMSPEAK3_VIRTUAL_SERVER', '1')) +TEAMSPEAK3_PUBLIC_URL = os.environ.get('AA_TEAMSPEAK3_PUBLIC_URL', 'yourdomain.com') + +###################################### +# Discord Configuration +###################################### +# DISCORD_SERVER_ID - ID of the server to manage +# DISCORD_USER_EMAIL - email of the server management user +# DISCORD_USER_PASSWORD - password of the server management user +###################################### +DISCORD_SERVER_ID = os.environ.get('AA_DISCORD_SERVER_ID', '') +DISCORD_USER_EMAIL = os.environ.get('AA_DISCORD_USER_EMAIL', '') +DISCORD_USER_PASSWORD = os.environ.get('AA_DISCORD_USER_PASSWORD', '') + +##################################### +# IPS4 Configuration +##################################### +# IPS4_URL - base url of the IPS4 install (no trailing slash) +# IPS4_API_KEY - API key provided by IPS4 +##################################### +IPS4_URL = os.environ.get('AA_IPS4_URL', 'http://yourdomain.com/ips4') +IPS4_API_KEY = os.environ.get('AA_IPS4_API_KEY', '') + +###################################### +# Fleet-Up Configuration +###################################### +# FLEETUP_APP_KEY - The app key from http://fleet-up.com/Api/MyApps +# FLEETUP_USER_ID - The user id from http://fleet-up.com/Api/MyKeys +# FLEETUP_API_ID - The API id from http://fleet-up.com/Api/MyKeys +# FLEETUP_GROUP_ID - The id of the group you want to pull data from, see http://fleet-up.com/Api/Endpoints#groups_mygroupmemberships +###################################### +FLEETUP_APP_KEY = os.environ.get('AA_FLEETUP_APP_KEY', '') +FLEETUP_USER_ID = os.environ.get('AA_FLEETUP_USER_ID', '') +FLEETUP_API_ID = os.environ.get('AA_FLEETUP_API_ID', '') +FLEETUP_GROUP_ID = os.environ.get('AA_FLEETUP_GROUP_ID', '') + +##################################### +# Logging Configuration +##################################### +# Set log_file and console level to desired state: +# DEBUG - basically stack trace, explains every step +# INFO - model creation, deletion, updates, etc +# WARN - unexpected function outcomes that do not impact user +# ERROR - unexcpeted function outcomes which prevent user from achieving desired outcome +# EXCEPTION - something critical went wrong, unhandled +##################################### +# Recommended level for log_file is INFO, console is DEBUG +# Change log level of individual apps below to narrow your debugging +##################################### +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'formatters': { + 'verbose': { + 'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", + 'datefmt' : "%d/%b/%Y %H:%M:%S" + }, + 'simple': { + 'format': '%(levelname)s %(message)s' + }, + }, + 'handlers': { + 'log_file': { + 'level': 'INFO', # edit this line to change logging level to file + 'class': 'logging.handlers.RotatingFileHandler', + 'filename': os.path.join(BASE_DIR,'log/allianceauth.log'), + 'formatter': 'verbose', + 'maxBytes': 1024*1024*5, # edit this line to change max log file size + 'backupCount': 5, # edit this line to change number of log backups + }, + 'console': { + 'level': 'DEBUG', # edit this line to change logging level to console + 'class': 'logging.StreamHandler', + 'formatter': 'verbose', + }, + 'notifications': { # creates notifications for users with logging_notifications permission + 'level': 'ERROR', # edit this line to change logging level to notifications + 'class': 'notifications.handlers.NotificationHandler', + 'formatter': 'verbose', + }, + }, + 'loggers': { + 'authentication': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'celerytask': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'eveonline': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'groupmanagement': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'hrapplications': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'portal': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'registration': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'services': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'srp': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'timerboard': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'sigtracker': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'optimer': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'corputils': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'util': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'DEBUG', + }, + 'django': { + 'handlers': ['log_file', 'console', 'notifications'], + 'level': 'ERROR', + }, + } +} + diff --git a/services/managers/fleetup_manager.py b/services/managers/fleetup_manager.py index c86c11c3..8d7a4fdf 100644 --- a/services/managers/fleetup_manager.py +++ b/services/managers/fleetup_manager.py @@ -71,7 +71,7 @@ class FleetUpManager(): @staticmethod def get_fleetup_doctrine(doctrinenumber): - url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/%s" % doctrinenumber + url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/DoctrineFittings/%s" % doctrinenumber jsondata = requests.get(url).content fdoctrine=json.loads(jsondata.decode()) From 49ed89c1534cacc0da2e8ebfabafb5a99e2dbd14 Mon Sep 17 00:00:00 2001 From: johanko Date: Thu, 7 Apr 2016 20:51:29 +0200 Subject: [PATCH 03/10] Update fleetupdoctrine.html --- .../templates/registered/fleetupdoctrine.html | 58 +++++++++---------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/stock/templates/registered/fleetupdoctrine.html b/stock/templates/registered/fleetupdoctrine.html index b6d0d2e7..1ad3a2a8 100644 --- a/stock/templates/registered/fleetupdoctrine.html +++ b/stock/templates/registered/fleetupdoctrine.html @@ -42,8 +42,7 @@

    {{ Role.grouper }}

    - - +
    @@ -55,35 +54,32 @@ {% for item in Role.list %} - - - - - - - - + + + + + + + - {% endfor %} - -
    Name
    - - - {{ item.Name }} - - {{ item.Role }} - - {{ item.HullType }} - - {{ item.ShipType }} - - {% load humanize %}{{ item.EstPrice|intword }} - - {% for categories in item.Categories %} - {{ categories }}, - {% endfor %} - + + + {{ item.Name }} + + {{ item.Role }} + + {{ item.HullType }} + + {{ item.ShipType }} + + {% load humanize %}{{ item.EstPrice|intword }} + + {% for categories in item.Categories %} + {{ categories }}, + {% endfor %} +
    - + {% endfor %} +
    {% endfor %} @@ -91,4 +87,4 @@ {% endfor %} -{% endblock content %} \ No newline at end of file +{% endblock content %} From 1759e32203f0e5a07c2a29dfac784e36a7e476a9 Mon Sep 17 00:00:00 2001 From: johanko Date: Thu, 7 Apr 2016 21:03:10 +0200 Subject: [PATCH 04/10] Update fleetup_manager.py --- services/managers/fleetup_manager.py | 1 - 1 file changed, 1 deletion(-) diff --git a/services/managers/fleetup_manager.py b/services/managers/fleetup_manager.py index 8d7a4fdf..a6708f62 100644 --- a/services/managers/fleetup_manager.py +++ b/services/managers/fleetup_manager.py @@ -20,7 +20,6 @@ class FleetUpManager(): jsondata = requests.get(url).content fmembers=json.loads(jsondata.decode()) - #return(fmembers) return {row["UserId"]:{"user_id":row["UserId"], "char_name":row["EveCharName"], "char_id":row["EveCharId"], From 81ecba59e4fb7e83ba999904c2fdb86a06a715a1 Mon Sep 17 00:00:00 2001 From: johanko Date: Mon, 18 Apr 2016 07:55:46 +0200 Subject: [PATCH 05/10] Update settings.py.example --- alliance_auth/settings.py.example | 5 ----- 1 file changed, 5 deletions(-) diff --git a/alliance_auth/settings.py.example b/alliance_auth/settings.py.example index b1f69627..5486d1f5 100644 --- a/alliance_auth/settings.py.example +++ b/alliance_auth/settings.py.example @@ -174,11 +174,6 @@ STATIC_ROOT = '/home/allianceserver/allianceauth/static/' # This directory needs to be writable by the webserver EVEWHO_CACHE_DIR = '{}/cache'.format(BASE_DIR) -# Cache directory for Fleet-Up, no ending / -# by default this becomes ~//alliance_auth/cache -# This directory needs to be writable by the webserver -FLEETUP_CACHE_DIR = '{}/cache'.format(BASE_DIR) - ##################################################### ## ## Auth configuration starts here From 819be1df4d9a0b7380e8208633e6d41672905a6d Mon Sep 17 00:00:00 2001 From: johanko Date: Mon, 18 Apr 2016 08:13:49 +0200 Subject: [PATCH 06/10] Update settings.py.example --- alliance_auth/settings.py.example | 58 ++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/alliance_auth/settings.py.example b/alliance_auth/settings.py.example index 5486d1f5..eb539b20 100644 --- a/alliance_auth/settings.py.example +++ b/alliance_auth/settings.py.example @@ -107,6 +107,7 @@ DATABASES = { 'HOST': os.environ.get('AA_DB_IPS4_HOST', '127.0.0.1'), 'PORT': os.environ.get('AA_DB_IPS4_PORT', '3306'), }, + 'smf': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'alliance_smf', @@ -114,6 +115,24 @@ DATABASES = { 'PASSWORD': os.environ.get('AA_DB_SMF_PASSWORD', 'password'), 'HOST': os.environ.get('AA_DB_SMF_HOST', '127.0.0.1'), 'PORT': os.environ.get('AA_DB_SMF_PORT', '3306'), + }, + + 'market': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'alliance_market', + 'USER': os.environ.get('AA_DB_MARKET_USER', 'allianceserver'), + 'PASSWORD': os.environ.get('AA_DB_MARKET_PASSWORD', 'password'), + 'HOST': os.environ.get('AA_DB_MARKET_HOST', '127.0.0.1'), + 'PORT': os.environ.get('AA_DB_MARKET_PORT', '3306'), + }, + + 'pathfinder': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'alliance_pathfinder', + 'USER': os.environ.get('AA_DB_PATHFINDER_USER', 'allianceserver'), + 'PASSWORD': os.environ.get('AA_DB_PATHFINDER_PASSWORD', 'password'), + 'HOST': os.environ.get('AA_DB_PATHFINDER_HOST', '127.0.0.1'), + 'PORT': os.environ.get('AA_DB_PATHFINDER_PORT', '3306'), } } @@ -169,10 +188,6 @@ USE_TZ = True STATIC_URL = '/static/' STATIC_ROOT = '/home/allianceserver/allianceauth/static/' -# Cache directory for EveWho, no ending / -# by default this becomes ~//alliance_auth/cache -# This directory needs to be writable by the webserver -EVEWHO_CACHE_DIR = '{}/cache'.format(BASE_DIR) ##################################################### ## @@ -243,8 +258,11 @@ BLUE_ALLIANCE_GROUPS = 'True' == os.environ.get('AA_BLUE_ALLIANCE_GROUPS', 'Fals # ENABLE_AUTH_MUMBLE - Enable mumble support in the auth for auth'd members # ENABLE_AUTH_IPBOARD - Enable IPBoard forum support in the auth for auth'd members # ENABLE_AUTH_DISCORD - Enable Discord support in the auth for auth'd members +# ENABLE_AUTH_DISCOURSE - Enable Discourse support in the auth for auth'd members # ENABLE_AUTH_IPS4 - Enable IPS4 support in the auth for auth'd members # ENABLE_AUTH_SMF - Enable SMF forum support in the auth for auth'd members +# ENABLE_AUTH_MARKET = Enable Alliance Market support in auth for auth'd members +# ENABLE_AUTH_PATHFINDER = Enable Alliance Pathfinder suppor in auth for auth'd members ######################### ENABLE_AUTH_FORUM = 'True' == os.environ.get('AA_ENABLE_AUTH_FORUM', 'False') ENABLE_AUTH_JABBER = 'True' == os.environ.get('AA_ENABLE_AUTH_JABBER', 'False') @@ -252,8 +270,11 @@ ENABLE_AUTH_MUMBLE = 'True' == os.environ.get('AA_ENABLE_AUTH_MUMBLE', 'False') ENABLE_AUTH_IPBOARD = 'True' == os.environ.get('AA_ENABLE_AUTH_IPBOARD', 'False') ENABLE_AUTH_TEAMSPEAK3 = 'True' == os.environ.get('AA_ENABLE_AUTH_TEAMSPEAK3', 'False') ENABLE_AUTH_DISCORD = 'True' == os.environ.get('AA_ENABLE_AUTH_DISCORD', 'False') +ENABLE_AUTH_DISCOURSE = 'True' == os.environ.get('AA_ENABLE_AUTH_DISCOURSE', 'False') ENABLE_AUTH_IPS4 = 'True' == os.environ.get('AA_ENABLE_AUTH_IPS4', 'False') ENABLE_AUTH_SMF = 'True' == os.environ.get('AA_ENABLE_AUTH_SMF', 'False') +ENABLE_AUTH_MARKET = 'True' == os.environ.get('AA_ENABLE_AUTH_MARKET', 'False') +ENABLE_AUTH_PATHFINDER = 'True' == os.environ.get('AA_ENABLE_AUTH_PATHFINDER', 'False') ##################### # Blue service Setup @@ -264,8 +285,11 @@ ENABLE_AUTH_SMF = 'True' == os.environ.get('AA_ENABLE_AUTH_SMF', 'False') # ENABLE_BLUE_MUMBLE - Enable mumble support in the auth for blues # ENABLE_BLUE_IPBOARD - Enable IPBoard forum support in the auth for blues # ENABLE_BLUE_DISCORD - Enable Discord support in the auth for blues +# ENABLE_BLUE_DISCOURSE - Enable Discord support in the auth for blues # ENABLE_BLUE_IPS4 - Enable IPS4 forum support in the auth for blues # ENABLE_BLUE_SMF - Enable SMF forum support in the auth for blues +# ENABLE_BLUE_MARKET - Enable Alliance Market in the auth for blues +# ENABLE_BLUE_PATHFINDER = Enable Pathfinder support in the auth for blues ##################### BLUE_STANDING = float(os.environ.get('AA_BLUE_STANDING', '5.0')) ENABLE_BLUE_FORUM = 'True' == os.environ.get('AA_ENABLE_BLUE_FORUM', 'False') @@ -274,8 +298,11 @@ ENABLE_BLUE_MUMBLE = 'True' == os.environ.get('AA_ENABLE_BLUE_MUMBLE', 'False') ENABLE_BLUE_IPBOARD = 'True' == os.environ.get('AA_ENABLE_BLUE_IPBOARD', 'False') ENABLE_BLUE_TEAMSPEAK3 = 'True' == os.environ.get('AA_ENABLE_BLUE_TEAMSPEAK3', 'False') ENABLE_BLUE_DISCORD = 'True' == os.environ.get('AA_ENABLE_BLUE_DISCORD', 'False') +ENABLE_BLUE_DISCOURSE = 'True' == os.environ.get('AA_ENABLE_BLUE_DISCOURSE', 'False') ENABLE_BLUE_IPS4 = 'True' == os.environ.get('AA_ENABLE_BLUE_IPS4', 'False') ENABLE_BLUE_SMF = 'True' == os.environ.get('AA_ENABLE_BLUE_SMF', 'False') +ENABLE_BLUE_MARKET = 'True' == os.environ.get('AA_ENABLE_BLUE_MARKET', 'False') +ENABLE_BLUE_PATHFINDER = 'True' == os.environ.get('AA_ENABLE_BLUE_PATHFINDER', 'False') ######################### # Corp Configuration @@ -313,6 +340,16 @@ MEMBER_API_ACCOUNT = 'True' == os.environ.get('AA_MEMBER_API_ACCOUNT', 'True') BLUE_API_MASK = os.environ.get('AA_BLUE_API_MASK', 8388608) BLUE_API_ACCOUNT = 'True' == os.environ.get('AA_BLUE_API_ACCOUNT', 'False') +########################## +# Pathfinder Configuration +########################## +PATHFINDER_URL = os.environ.get('AA_PATHFINDER_URL', 'http://pathfinder.yourdomain.com') + +##################### +# Alliance Market +##################### +MARKET_URL = os.environ.get('AA_MARKET_URL', 'http://yourdomain.com/market') + ##################### # HR Configuration ##################### @@ -391,6 +428,18 @@ DISCORD_SERVER_ID = os.environ.get('AA_DISCORD_SERVER_ID', '') DISCORD_USER_EMAIL = os.environ.get('AA_DISCORD_USER_EMAIL', '') DISCORD_USER_PASSWORD = os.environ.get('AA_DISCORD_USER_PASSWORD', '') +###################################### +# Discourse Configuration +###################################### +# DISCOURSE_URL - Web address of the forums (no trailing slash) +# DISCOURSE_API_USERNAME - API account username +# DISCOURSE_API_KEY - API Key +###################################### +DISCOURSE_URL = os.environ.get('AA_DISCOURSE_URL', '') +DISCOURSE_API_USERNAME = os.environ.get('AA_DISCOURSE_API_USERNAME', '') +DISCOURSE_API_KEY = os.environ.get('AA_DISCOURSE_API_KEY', '') + + ##################################### # IPS4 Configuration ##################################### @@ -521,4 +570,3 @@ LOGGING = { }, } } - From d2865c97e1bab8bebe1b7b1e7d1450d72da72125 Mon Sep 17 00:00:00 2001 From: johanko Date: Thu, 21 Apr 2016 10:59:39 +0000 Subject: [PATCH 07/10] API call time-out handling --- services/managers/fleetup_manager.py | 40 ++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/services/managers/fleetup_manager.py b/services/managers/fleetup_manager.py index a6708f62..b5fca751 100644 --- a/services/managers/fleetup_manager.py +++ b/services/managers/fleetup_manager.py @@ -17,7 +17,10 @@ class FleetUpManager(): @staticmethod def get_fleetup_members(): url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/GroupCharacters/" + str(groupid) + "" - jsondata = requests.get(url).content + try: + jsondata = requests.get(url).content + except requests.exceptions.ConnectionError: + r.status_code = "Connection timeout" fmembers=json.loads(jsondata.decode()) return {row["UserId"]:{"user_id":row["UserId"], @@ -48,7 +51,10 @@ class FleetUpManager(): @staticmethod def get_fleetup_timers(): url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/Timers/" + str(groupid) + "" - jsondata = requests.get(url).content + try: + jsondata = requests.get(url).content + except requests.exceptions.ConnectionError: + r.status_code = "Connection timeout" ftimers=json.loads(jsondata.decode()) return {row["ExpiresString"]:{"solarsystem":row["SolarSystem"], @@ -63,7 +69,10 @@ class FleetUpManager(): @staticmethod def get_fleetup_doctrines(): url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/Doctrines/" + str(groupid) + "" - jsondata = requests.get(url).content + try: + jsondata = requests.get(url).content + except requests.exceptions.ConnectionError: + r.status_code = "Connection timeout" fdoctrines=json.loads(jsondata.decode()) return {"fleetup_doctrines":fdoctrines["Data"]} @@ -71,7 +80,10 @@ class FleetUpManager(): @staticmethod def get_fleetup_doctrine(doctrinenumber): url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/DoctrineFittings/%s" % doctrinenumber - jsondata = requests.get(url).content + try: + jsondata = requests.get(url).content + except requests.exceptions.ConnectionError: + r.status_code = "Connection timeout" fdoctrine=json.loads(jsondata.decode()) return {"fitting_doctrine":fdoctrine} @@ -79,7 +91,10 @@ class FleetUpManager(): @staticmethod def get_fleetup_fittings(): url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/Fittings/" + str(groupid) + "" - jsondata = requests.get(url).content + try: + jsondata = requests.get(url).content + except requests.exceptions.ConnectionError: + r.status_code = "Connection timeout" ffittings=json.loads(jsondata.decode()) return {row["FittingId"]:{"fitting_id":row["FittingId"], @@ -95,7 +110,10 @@ class FleetUpManager(): @staticmethod def get_fleetup_fitting(fittingnumber): url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/Fitting/%s" % fittingnumber - jsondata = requests.get(url).content + try: + jsondata = requests.get(url).content + except requests.exceptions.ConnectionError: + r.status_code = "Connection timeout" ffitting=json.loads(jsondata.decode()) return {"fitting_data":ffitting["Data"]} @@ -103,7 +121,10 @@ class FleetUpManager(): @staticmethod def get_fleetup_doctrineid(fittingnumber): url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/Fitting/%s" % fittingnumber - jsondata = requests.get(url).content + try: + jsondata = requests.get(url).content + except requests.exceptions.ConnectionError: + r.status_code = "Connection timeout" fdoctrineid=json.loads(jsondata.decode()) return fdoctrineid['Data']['Doctrines'][0]['DoctrineId'] @@ -111,7 +132,10 @@ class FleetUpManager(): @staticmethod def get_fleetup_fitting_eft(fittingnumber): url = "http://api.fleet-up.com/Api.svc/" + str(appkey) + "/" + str(userid) + "/" + str(apiid) + "/Fitting/%s/eft" % fittingnumber - jsondata = requests.get(url).content + try: + jsondata = requests.get(url).content + except requests.exceptions.ConnectionError: + r.status_code = "Connection timeout" ffittingeft=json.loads(jsondata.decode()) return {"fitting_eft":ffittingeft["Data"]["FittingData"]} From 6221f42873ef49b7e73eb57a11e60e01e4bef7c6 Mon Sep 17 00:00:00 2001 From: johanko Date: Thu, 21 Apr 2016 13:28:50 +0200 Subject: [PATCH 08/10] Permissions to see characters Changed permissions to see chars registered on fleet-up.com to human_resources --- stock/templates/registered/fleetup.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stock/templates/registered/fleetup.html b/stock/templates/registered/fleetup.html index c4a5a00b..a592df70 100644 --- a/stock/templates/registered/fleetup.html +++ b/stock/templates/registered/fleetup.html @@ -23,7 +23,7 @@
  • Ops and Timers (current)
  • Doctrines
  • Fittings
  • - {% if perms.auth.corp_stats %} + {% if perms.auth.human_resources %}
  • Characters
  • {% endif %}
  • @@ -218,4 +218,4 @@ function updateClock() { } -{% endblock content %} \ No newline at end of file +{% endblock content %} From d8b58866ae89bab29fb4f071b95bccfac2fd4b7c Mon Sep 17 00:00:00 2001 From: johanko Date: Thu, 21 Apr 2016 21:20:09 +0200 Subject: [PATCH 09/10] Update fleetup.html removed leftover testing --- stock/templates/registered/fleetup.html | 4 ---- 1 file changed, 4 deletions(-) diff --git a/stock/templates/registered/fleetup.html b/stock/templates/registered/fleetup.html index a592df70..df0d5243 100644 --- a/stock/templates/registered/fleetup.html +++ b/stock/templates/registered/fleetup.html @@ -156,7 +156,6 @@ Structure Location Expires(EVE-time) - Owner Note @@ -176,9 +175,6 @@ {{ type.expires|date:"l d M H:i" }} - {{ type.owner }} From c26f1af41c371708f88959de763f73fb0b43bb25 Mon Sep 17 00:00:00 2001 From: johanko Date: Fri, 29 Apr 2016 10:52:09 +0200 Subject: [PATCH 10/10] Update fleetup_manager.py --- services/managers/fleetup_manager.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/services/managers/fleetup_manager.py b/services/managers/fleetup_manager.py index b5fca751..09f08d85 100644 --- a/services/managers/fleetup_manager.py +++ b/services/managers/fleetup_manager.py @@ -1,4 +1,5 @@ from django.conf import settings +from django.http import HttpResponse from datetime import datetime import logging @@ -20,7 +21,7 @@ class FleetUpManager(): try: jsondata = requests.get(url).content except requests.exceptions.ConnectionError: - r.status_code = "Connection timeout" + return HttpResponse("Can't connect to Fleet-Up API, is it offline?!") fmembers=json.loads(jsondata.decode()) return {row["UserId"]:{"user_id":row["UserId"], @@ -34,7 +35,7 @@ class FleetUpManager(): try: jsondata = requests.get(url).content except requests.exceptions.ConnectionError: - r.status_code = "Connection timeout" + return HttpResponse("Can't connect to Fleet-Up API, is it offline?!") foperations=json.loads(jsondata.decode()) return {row["StartString"]:{"subject":row["Subject"], @@ -54,7 +55,7 @@ class FleetUpManager(): try: jsondata = requests.get(url).content except requests.exceptions.ConnectionError: - r.status_code = "Connection timeout" + return HttpResponse("Can't connect to Fleet-Up API, is it offline?!") ftimers=json.loads(jsondata.decode()) return {row["ExpiresString"]:{"solarsystem":row["SolarSystem"], @@ -72,7 +73,7 @@ class FleetUpManager(): try: jsondata = requests.get(url).content except requests.exceptions.ConnectionError: - r.status_code = "Connection timeout" + return HttpResponse("Can't connect to Fleet-Up API, is it offline?!") fdoctrines=json.loads(jsondata.decode()) return {"fleetup_doctrines":fdoctrines["Data"]} @@ -83,7 +84,7 @@ class FleetUpManager(): try: jsondata = requests.get(url).content except requests.exceptions.ConnectionError: - r.status_code = "Connection timeout" + return HttpResponse("Can't connect to Fleet-Up API, is it offline?!") fdoctrine=json.loads(jsondata.decode()) return {"fitting_doctrine":fdoctrine} @@ -94,7 +95,7 @@ class FleetUpManager(): try: jsondata = requests.get(url).content except requests.exceptions.ConnectionError: - r.status_code = "Connection timeout" + return HttpResponse("Can't connect to Fleet-Up API, is it offline?!") ffittings=json.loads(jsondata.decode()) return {row["FittingId"]:{"fitting_id":row["FittingId"], @@ -113,7 +114,7 @@ class FleetUpManager(): try: jsondata = requests.get(url).content except requests.exceptions.ConnectionError: - r.status_code = "Connection timeout" + return HttpResponse("Can't connect to Fleet-Up API, is it offline?!") ffitting=json.loads(jsondata.decode()) return {"fitting_data":ffitting["Data"]} @@ -124,7 +125,7 @@ class FleetUpManager(): try: jsondata = requests.get(url).content except requests.exceptions.ConnectionError: - r.status_code = "Connection timeout" + return HttpResponse("Can't connect to Fleet-Up API, is it offline?!") fdoctrineid=json.loads(jsondata.decode()) return fdoctrineid['Data']['Doctrines'][0]['DoctrineId'] @@ -135,7 +136,7 @@ class FleetUpManager(): try: jsondata = requests.get(url).content except requests.exceptions.ConnectionError: - r.status_code = "Connection timeout" + return HttpResponse("Can't connect to Fleet-Up API, is it offline?!") ffittingeft=json.loads(jsondata.decode()) return {"fitting_eft":ffittingeft["Data"]["FittingData"]}