Basraah 1066e6ac98 The Great Services Refactor (#594)
* Hooks registration, discovery and retrieval module

Will discover @hooks.register decorated functions inside
the auth_hooks module in any installed django app.

* Class to register modular service apps

* Register service modules URLs

* Example service module

* Refactor services into modules

Each service type has been split out into its own django app/module. A
hook mechanism is provided to register a subclass of the ServiceHook
class. The modules then overload functions defined in ServiceHook as
required to provide interoperability with alliance auth. Service modules
provide their own urls and views for user registration and account
management and a partial template to display on the services page. Where
possible, new modules should provide their own models for local data
storage.

* Added menu items hooks and template tags

* Added menu item hook for broadcasts

* Added str method to ServicesHook

* Added exception handling to hook iterators

* Refactor mumble migration and table name

Upgrading will require `migrate mumble --fake-initial` to be run first
and then `migrate mumble` to rename the table.

* Refactor teamspeak3 migration and rename table

Upgrading will require `migrate teamspeak3 --fake-initial`

* Added module models and migrations for refactoring AuthServicesInfo

* Migrate AuthServiceInfo fields to service modules models

* Added helper for getting a users main character

* Added new style celery instance

* Changed Discord from AuthServicesInfo to DiscordUser model

* Switch celery tasks to staticmethods

* Changed Discourse from AuthServicesInfo to DiscourseUser model

* Changed IPBoard from AuthServicesInfo to IpboardUser model

* Changed Ips4 from AuthServicesInfo to Ips4User model

Also added disable service task.

This service still needs some love though. Was always missing a
deactivate services hook (before refactoring) for reasons I'm unsure of
so I'm reluctant to add it without knowing why.

* Changed Market from AuthServicesInfo to MarketUser model

* Changed Mumble from AuthServicesInfo to MumbleUser model

Switched user foreign key to one to one relationship.
Removed implicit password change on user exists.
Combined regular and blue user creation.

* Changed Openfire from AuthServicesInfo to OpenfireUser model

* Changed SMF from AuthServicesInfo to SmfUser model

Added disable task

* Changed Phpbb3 from AuthServicesInfo to Phpbb3User model

* Changed XenForo from AuthServicesInfo to XenforoUser model

* Changed Teamspeak3 from AuthServicesInfo to Teamspeak3User model

* Remove obsolete manager functions

* Standardise URL format

This will break some callback URLs
Discord changes from /discord_callback/ to /discord/callback/

* Removed unnecessary imports

* Mirror upstream decorator change

* Setup for unit testing

* Unit tests for discord service

* Added add main character helper

* Added Discourse unit tests

* Added Ipboard unit tests

* Added Ips4 unit tests

* Fix naming of market manager, switch to use class methods

* Remove unused hook functions

* Added market service unit tests

* Added corp ticker to add main character helper

* Added mumble unit tests

* Fix url name and remove namespace

* Fix missing return and add missing URL

* Added openfire unit tests

* Added missing return

* Added phpbb3 unit tests

* Fix SmfManager naming inconsistency and switch to classmethods

* Added smf unit tests

* Remove unused functions, Added missing return

* Added xenforo unit tests

* Added missing return

* Fixed reference to old model

* Fixed error preventing groups from syncing on reset request

* Added teamspeak3 unit tests

* Added nose as test runner and some test settings

* Added package requirements for running tests

* Added unit tests for services signals and tasks

* Remove unused tests file

* Fix teamspeak3 service signals

* Added unit tests for teamspeak3 signals

Changed other unit tests setUp to inert signals

* Fix password gen and hashing python3 compatibility

Fixes #630

Adds unit tests to check the password functions run on both platforms.

* Fix unit test to not rely on checking url params

* Add Travis CI settings file

* Remove default blank values from services models

* Added dynamic user model admin actions for syncing service groups

* Remove unused search fields

* Add hook function for syncing nicknames

* Added discord hook for sync nickname

* Added user admin model menu actions for sync nickname hook

* Remove obsolete code

* Rename celery config app to avoid package name clash

* Added new style celerybeat schedule configuration

periodic_task decorator is depreciated

* Added string representations

* Added admin pages for services user models

* Removed legacy code

* Move link discord button to correct template

* Remove blank default fields from example model

* Disallow empty django setting

* Fix typos

* Added coverage configuration file

* Add coverage and coveralls to travis config

Should probably use nose's built in coverage, but this works for now.

* Replace AuthServicesInfo get_or_create instances with get

Reflects upstream changes to AuthServicesInfo behaviour.

* Update mumble user table name

* Split out mumble authenticator requirements

zeroc-ice seems to cause long build times on travis-ci and isn't
required for the core projects functionality or testing.
2017-01-25 12:50:16 +10:00

245 lines
12 KiB
HTML
Executable File

{% load staticfiles %}
{% load i18n %}
{% load navactive %}
{% load menu_items %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>{% block title %}Alliance Auth{% endblock title %}</title>
<!-- Bootstrap Core CSS -->
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<!-- Custom Fonts -->
<link href="{% static 'css/font-awesome.min.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'css/sb-admin-2.css' %}" rel="stylesheet">
{% block extra_css %}{% endblock extra_css %}
<style>
.grayiconecolor {
color: #505050;
}
#lang_select {
margin-right: 25px;
}
#f_lang_select {
margin-right: 5px;
}
.navbar-brand {
height: 58px;
padding: 19px 19px;
}
</style>
</head>
<body>
{% if user.is_authenticated %}
<div id="wrapper">
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<a class="navbar-brand">
{{ SITE_NAME }}
</a>
<!-- /.navbar-header -->
<ul class="nav navbar-top-links navbar-right">
<li class="nav-link">
<form id="f_lang_select" action="{% url 'set_language' %}" method="post">
{% csrf_token %}
<input name="next" type="hidden" value="{{ request.get_full_path|slice:'3:' }}" />
<select onchange="this.form.submit()" class="form-control" id="lang_select" name="language">
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected="selected"{% endif %}>
{{ language.name_local }} ({{ language.code }})
</option>
{% endfor %}
</select>
</form>
</li>
{% if notifications %}
<li class="nav-link active">
<a href="{% url 'auth_notification_list' %}">
<span class="fa-stack">
<i class="fa fa-bell fa-stack-2x"></i>
<i class="fa fa-inverse fa-stack-1x">{{ notifications }}</i>
</span>
</a>
</li>
{% else %}
<li class="nav-link"><a href="{% url 'auth_notification_list' %}">
<i class="fa fa-bell-o"></i></a>
</li>
{% endif %}
{% if user.is_authenticated %}
{% if user.is_staff %}
<li><a href="{% url 'admin:index' %}">Admin</a></li>
{% endif %}
<li><a href="{% url 'auth_logout_user' %}">{% trans "Logout" %}</a></li>
{% else %}
<li><a href="{% url 'auth_login_user' %}">{% trans "Login" %}</a></li>
{% endif %}
</ul>
</div>
<!-- /.navbar-top-links -->
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<li class="text-center divider-horizontal">
<h5>{% trans "Main Navigation" %}</h5>
</li>
<li>
<a class="{% navactive request 'auth_dashboard' %}" href="{% url 'auth_dashboard' %}">
<i class="fa fa-dashboard fa-fw grayiconecolor"></i>{% trans " Dashboard" %}
</a>
</li>
{% if STATE == MEMBER_STATE or user.is_superuser %}
<li>
<a class="{% navactive request 'auth_groups' %}" href="{% url 'auth_groups' %}">
<i class="fa fa-cogs fa-fw fa-sitemap grayiconecolor"></i>{% trans " Groups" %}
</a>
</li>
{% endif %}
<li>
<a class="{% navactive request 'auth_help' %}" href="{% url 'auth_help' %}">
<i class="fa fa-question fa-fw grayiconecolor"></i>{% trans " Help" %}
</a>
</li>
{% menu_main %}
<li class="text-center divider-horizontal">
<h5>{% trans "Aux Navigation" %}</h5>
</li>
{% if STATE in MEMBER_BLUE_STATE or user.is_superuser %}
<li>
<a class="{% navactive request 'auth_services' %}" href="{% url 'auth_services' %}">
<i class="fa fa-cogs fa-fw grayiconecolor"></i>{% trans " Services" %}
</a>
</li>
{% endif %}
{% if not STATE == MEMBER_STATE or perms.auth.human_resources %}
<li>
<a class="{% navactive request 'auth_hrapplications_view auth_hrapplication_create_view auth_hrapplication_personal_view auth_hrapplication_search auth_hrapplication_view' %}"
href="{% url 'auth_hrapplications_view' %}">
<i class="fa fa-file-o fa-fw grayiconecolor"></i>{% trans " Applications" %}
</a>
</li>
{% endif %}
{% if perms.corputils.view_corp_corpstats or perms.corputils.view_alliance_corpstats or perms.corputils.view_blue_corpstats %}
<li>
<a class="{% navactive request 'corputils:view corputils:search' %}" href="{% url 'corputils:view' %}">
<i class="fa fa-share-alt fa-fw grayiconecolor"></i>{% trans " Corporation Stats" %}
</a>
</li>
{% endif %}
{% if can_manage_groups %}
<li>
<a class="{% navactive request 'auth_group_management auth_group_membership auth_group_membership_list' %}" href="{% url 'auth_group_management' %}">
<i class="fa fa-lock fa-sitemap fa-fw grayiconecolor"></i>{% trans " Group Management" %}
</a>
</li>
{% endif %}
{% if STATE in MEMBER_BLUE_STATE or user.is_superuser %}
<li>
<a class="{% navactive request 'auth_fleetup_view auth_fleetup_fittings auth_fleetup_fitting auth_fleetup_doctrines auth_fleetup_doctrine auth_fleetup_characters' %}" href="{% url 'auth_fleetup_view' %}">
<i class="fa fa-clock-o fa-fw grayiconecolor"></i> Fleet-Up
</a>
</li>
{% endif %}
{% if STATE in MEMBER_BLUE_STATE or user.is_superuser %}
{% if perms.auth.optimer_view %}
<li>
<a class="{% navactive request 'auth_optimer_view auth_add_optimer_view auth_edit_optimer' %}" href="{% url 'auth_optimer_view' %}">
<i class="fa fa-exclamation fa-fw grayiconecolor"></i>{% trans " Fleet Operations" %}
</a>
</li>
{% endif %}
{% if perms.auth.timer_view %}
<li>
<a class="{% navactive request 'auth_timer_view auth_add_timer_view auth_edit_timer' %}" href="{% url 'auth_timer_view' %}">
<i class="fa fa-clock-o fa-fw grayiconecolor"></i>{% trans " Structure Timers" %}
</a>
</li>
{% endif %}
<li>
<a class="{% navactive request 'auth_fatlink_view auth_fatlink_view_statistics auth_fatlink_view_statistics_month auth_fatlink_view_personal_statistics auth_fatlink_view_personal_statistics_year auth_fatlink_view_personal_statistics_month auth_fatlink_view_user_statistics_month auth_create_fatlink_view auth_modify_fatlink_view auth_click_fatlink_view' %}" href="{% url 'auth_fatlink_view' %}">
<i class="fa fa-users fa-lightbulb-o fa-fw grayiconecolor"></i> Fleet Activity Tracking
</a>
</li>
<li>
<a class="{% navactive request 'auth_srp_management_view auth_srp_management_all_view auth_srp_fleet_view auth_srp_fleet_add_view auth_srp_fleet_edit_view auth_srp_request_view auth_srp_request_update_amount_view' %}" href="{% url 'auth_srp_management_view' %}">
<i class="fa fa-money fa-fw grayiconecolor"></i>{% trans " Ship Replacement" %}
</a>
</li>
{% endif %}
{% menu_aux %}
<li class="text-center divider-horizontal">
<h5>{% trans "Util" %}</h5>
</li>
<li>
<a class="{% navactive request 'password_change password_change_done' %}" href="{% url 'password_change' %}">
<i class="fa fa-lock fa-fw grayiconecolor"></i>{% trans "Change Password" %}
</a>
</li>
{% if STATE in MEMBER_BLUE_STATE or user.is_superuser %}
<li>
<a class="{% navactive request 'auth_fleet_format_tool_view' %}" href="{% url 'auth_fleet_format_tool_view' %}">
<i class="fa fa-space-shuttle fa-fw grayiconecolor"></i>{% trans " Fleet Broadcast Formatter" %}
</a>
</li>
{% endif %}
{% menu_util %}
</ul>
</div>
<!-- /.sidebar-collapse -->
</div>
<!-- /.navbar-static-side -->
</nav>
<div id="page-wrapper">
<div class="container">
{% if messages %}
<br>
{% for message in messages %}
<div class="alert alert-{{ message.level_tag}}">{{ message }}</div>
{% endfor %}
{% endif %}
{% block content %}
{% endblock content %}
</div>
</div>
</div>
{% endif %}
<script src="{% static 'js/jquery.min.js' %}"></script>
<script src="{% static 'js/jquery.datetimepicker.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script>{% block extra_script %}
{% endblock extra_script %}</script>
</body>
</html>