93 Commits

Author SHA1 Message Date
Adarnof
7ca1c87c87 Minimize swagger spec files. 2017-09-20 01:31:04 -04:00
Adarnof
eee6a9132d Use local swagger spec files (#866)
Allows auth to keep working if CCP changes "latest" definition.
Requires adarnauth-esi>=1.4
2017-09-17 01:08:02 -04:00
Basraah
9d90af4a3d Fixes #865 & adds unit tests 2017-09-13 20:16:07 +10:00
Adarnof
8f58f76001 Stop using v3(dev) Alliance resource
It keeps changing.
2017-09-12 20:16:15 -04:00
Adarnof
a969b6117b Fix missing operation in v3 alliance resource 2017-09-12 12:34:43 -04:00
ghoti
e6532025f8 fixes #848 - could be bug, could be permanent unclear change from CCP (#854) 2017-09-01 00:29:31 -04:00
ghoti
d937d5b5d4 Use primary key instead of user object for api_refresh 2017-07-11 21:39:29 -04:00
Adarnof
12cfc552da Correct Corporation creation using XML provider
Closes #734
2017-05-04 22:41:27 -04:00
Basraah
17dd7c04c7 Replace django-celery with base Celery (#791)
Update celery tasks to new style & remove djcelery
Vanilla celery + django-celery-beat take over the role of djcelery. Task schedules are consolidated into settings instead of residing in code.
Update docs and example supervisor configs.
2017-05-03 16:53:16 -04:00
Adarnof
6c94640552 Set main_char_id to emptystring when main deleted
Closes #769
2017-03-18 21:30:17 -04:00
Adarnof
7c14aede26 Correct ObjectNotFound message for ESI corp IDs
Addresses #732
2017-02-23 17:32:09 -05:00
Adarnof
5cec2f834b Hard-code ESI resource versions (#726)
Should prevent #718
2017-02-20 23:19:39 -05:00
iAddz
a6c48f8d71 Localisation & German translation updates (#701) 2017-02-11 23:04:18 -05:00
Adarnof
8c82897a92 Support static blue corps and alliances (#708) 2017-02-11 22:05:32 -05:00
Basraah
914c204a40 SeAT Manager (#704)
* SeAT service in modular service app format

* Replace string concatenation with formatters

* Fix incorrect references to user

* Fix exception when user doesn't have seat active

* Prevent deletion of seat API keys by default

* Improve api response error handling

* Corrected notification message

* Added missing view returns

* Update SeAT to use permissions based access

* Update password generator to new style

* Correct logging message

* Fix seat role update tasks

* Correct validate user logic

* Add seat test settings

* Added basic seat unit tests

* Added add permissions function from other branch

* Remove obsolete settings references
2017-02-11 22:04:47 -05:00
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
Adarnof
88534837e2 Merge pull request #665 from allianceauth/provider
Correct startup error when provider settings blank
2017-01-22 12:27:21 -05:00
Adarnof
026b4c272b Correct startup error when settings blank 2017-01-22 12:15:32 -05:00
Adarnof
0292ad07ad Customizable API auditing URLs via template filter (#652)
Closes #636
2017-01-19 23:01:26 -05:00
Adarnof
0b57e027f7 Variable itemtype name datasources (#662)
Make provider settings optional
Wait to initialize adapter until first external call
Abstract get methods from adapter
2017-01-19 19:19:20 -05:00
Adarnof
ff3bb9743f Enforce unique IDs and names for eveonline models (#657)
Should help narrow down #656. Please report IntegrityErrors.
2017-01-18 19:52:04 -05:00
Adarnof
cced434a99 Correct API key form validation errors.
If an individual field fails, its value gets removed from the cleaned_data dict, but the full form clean() method still gets called.
As this form checks for api_id and api_key in the dict upon clean(), it would raise an unhandled KeyError
2017-01-17 23:49:55 -05:00
Adarnof
55cbbadc2b Cache EVE API objects using django-redis to speed repeated queries. (#638) 2017-01-13 20:56:41 -05:00
Adarnof
8360371ab7 Enforce unique AuthServicesInfo (#618)
Alter user field to OneToOneField
Migration to enforce uniqueness pre-change
Migration to ensure all users have an AuthServicesInfo
Receiver to automatically create one upon user creation
Replace AuthServicesInfo.get_or_create with get
Prevent deletion of AuthServicesInfo from admin site
Remove add and delete permissions from model.

Get character names in chunks on corpstats update to prevent HTTP400 when requesting >350(ish) names

Include corpstats docs.
Update settings docs.
2017-01-11 21:48:20 -05:00
Adarnof
ab3c671d53 Only initialize clients specified in settings 2017-01-07 23:30:56 -05:00
Adarnof
c4a6492ab5 Cache related objects to speed queries (#616) 2017-01-06 01:10:12 -05:00
Adarnof
3d25f58fbb Correct missing ticker. 2017-01-05 00:23:06 -05:00
Adarnof
653bb97c55 Correct standing model creation 2017-01-03 13:18:04 -05:00
Adarnof
56082848a7 EVE Swagger Interface (#591)
FAT uses ESI tokens to get character location/ship
 - closes #564

 Pull corp memebrship data from ESI

Additional permissions for non-api viewing.
 - migration to convert permissions from old users.

Standardize EVE datasource responses.
 - allow different sources for EVE data types.

Allow empty values for character alliance id and name

Allow multiple corps and alliances to be considered 'members'
2017-01-02 20:50:21 -05:00
Adarnof
1e523d762e Remove references to legacy character management.
Correct group name spacing.
2016-12-29 17:41:00 -05:00
Basraah
2dd75b5100 Switched styling to warning, added tooltip 2016-11-24 10:56:36 +10:00
Basraah
1c4d2533b1 Replace API key management w/ ported profile page
Shows characters on each API key, main character, API key
status and the user groups.
2016-11-23 21:17:44 +10:00
Adarnof
97743cfe16 Prevent admin error when EveCharacter has no assigned user. 2016-11-13 16:51:15 -05:00
Adarnof
b4dc624b17 Correctly throw ApiInvalidError when API key deleted (222)
Do not assume keys are invalid on unrecognized codes.
Closes #574
2016-11-05 20:47:51 -04:00
Adarnof
98e1689aab Record API SSO status (#568)
Added sso_verified flag to EveApiKeyPair
Set sso_verified flag when user validates API key
Allow users to SSO validate existing API keys
2016-11-01 23:22:15 -04:00
Adarnof
e77c162fa0 API SSO, Beautification of Tables, and more. (#562)
# One Thousandth Commit 🎉 🎈 🎆 🍾

* Allow requiring API ownership validation by SSO.
Closes #163

* Add Discourse group name length restrictions.

* Redirect after api addition/deletion of main character

* Correct admin searching for removed discourse_username field in AuthServicesInfo

* Correct admin function to sync user Discourse groups

* Beautify tables by removing borders and hiding when empty.

*Add buttons on dead-end pages to return to originating view.
2016-10-27 23:28:00 -04:00
Adarnof
1daf77709d Abort API refresh when API servers unreachable.
Sorry aboot today.
2016-10-21 20:39:00 -04:00
Adarnof
1b4f5e4e88 Adarnof's Little Things (#547)
* Port to Django 1.10
Initial migrations for current states of all models. Requires faking to retain data.
Removed all references to render_to_response, replacing with render shortcut.
Same for HttpResponseRedirect to render shortcut.
Corrected notification signal import to wait for app registry to finish loading.

* Correct typos from render conversion

* Modify models to suppress Django field warnings

* Script for automatic database conversion
 - fakes initial migrations to preserve data
Include LOGIN_URL setting

* Correct context processor import typo

* Removed pathfinder support.
Current pathfinder versions require SSO, not APIs added to database.
Conditionally load additional database definitions only if services are enabled.
Prevents errors when running auth without creating all possible databases.

* Condense context processors

* Include Django 1.10 installation in migrate script
Remove syncdb/evolve, replace with migrate for update script

* Replaced member/blue perms with user state system
Removed sigtracker
Initial migrations for default perms and groups
Removed perm bootstrapping on first run

* Clean up services list

* Remove fleet fittings page

* Provide action feedback via django messaging
Display unread notification count
Correct left navbar alignment

* Stop storing service passwords.
Provide them one time upon activation or reset.
Closes #177

* Add group sync buttons to admin site
Allow searcing of AuthServicesInfo models
Display user main character

* Correct button CSS to remove underlines on hover

* Added bulk actions to notifications
Altered notification default ordering

* Centralize API key validation.
Remove unused error count on API key model.
Restructure API key refresh task to queue all keys per user and await completion.
Closes #350

* Example configuration files for supervisor.
Copy to /etc/supervisor/conf.d and restart to take effect.
Closes #521
Closes #266

* Pre-save receiver for member/blue state switching
Removed is_blue field
Added link to admin site

* Remove all hardcoded URLs from views and templates
Correct missing render arguments
Closes #540

* Correct celeryd process directory

* Migration to automatically set user states.
Runs instead of waiting for next API refresh cycle. Should make the transition much easier.

* Verify service accounts accessible to member state

* Restructure project to remove unnecessary apps.
(celerytask, util, portal, registraion apps)
Added workarounds for python 3 compatibility.

* Correct python2 compatibility

* Check services against state being changed to

* Python3 compatibility fixes

* Relocate x2bool py3 fix

* SSO integration for logging in to existing accounts.

* Add missing url names for fleetup reverse

* Sanitize groupnames before syncing.

* Correct trailing slash preventing url resolution

* Alter group name sanitization to allow periods and hyphens

* Correct state check on pre_save model for corp/alliance group assignment

* Remove sigtracker table from old dbs to allow user deletion

* Include missing celery configuration

* Teamspeak error handling

* Prevent celery worker deadlock on async group result wait

* Correct active navbar links for translated urls.
Correct corp status url resolution for some links.
Remove DiscordAuthToken model.
2016-10-16 18:01:14 -04:00
Adarnof
65e5e8ebb8 Update admin.py 2016-07-29 11:50:44 -04:00
Adarnof
507634ffdc Add main character field to character admin 2016-07-28 12:02:39 -04:00
Adarnof
9227122633 correct admin site registration for old django 2016-07-11 19:17:14 +00:00
Adarnof
470e51d8ec Extend EveCharacter admin page
display and allow searching of relevant fields
2016-07-11 16:18:21 +00:00
iAddz
c9e490a5c5 Added German Translations (#406)
* Added German Translations

Translated using
https://docs.djangoproject.com/en/1.9/topics/i18n/translation/

Added language drop down menu's for base.html, registration & login
pages

Known issues:
* Translated items in whtracker>create signature remain translated when
posted
* No date/time localisation for Fleet/Structure timers

* Added time locale

Added date/time locale to
*Structure Timers
*Fleet Timers
*Fleet timer form datetimepicker.js

Fixed a bug where the bootstrap label didn't show up when making a
structure timer using the translated form

Missed some base.html translations

* Small translation error

Some obscure SRP strings went unnoticed for context review

* FAT & Fleet-up German Translations

+ a fix in settings.py.example

The only small thing not done is German Date/Time locale for Fleet-up

* Compiled de/django.po
2016-06-16 22:54:04 +00:00
moriartyj
f6a177295d Automatic rejection of old API IDs (#441)
Automatic rejection of old API IDs
Closes #436
2016-05-27 09:24:35 -04:00
Adarnof
d461e6af79 Move error handling to api calls
- allows interpretation of diffferent evelink codes
2016-03-17 22:18:02 +00:00
Mr McClain
170221169c Changed Logging levels to debug 2016-03-08 17:48:37 -06:00
Adarnof
fa60be3675 Ensure entered api ID is int
Auth accepts these values in either order for building the model, but incorrectly assigns the vcode instead of ID to character models if entered incorrectly which can break certain functions.

This is an added layer of stupid-protection to make sure they put the API ID (a number) in the right field.
2016-03-06 15:58:11 -05:00
Ydmir
a2438b2e16 Merged corpstats and membertracking. Added two new permissions, corp_apis and alliance_apis. 2016-02-26 00:15:10 +01:00
Adarnof
6bbea6eeda Added check to ensure api is valid before pulling characters 2016-02-18 20:25:43 +00:00
Adarnof
2bf133ceee Corrections 2016-02-07 17:28:16 +00:00