247 Commits

Author SHA1 Message Date
Adarnof
313cac6ac7 Handle new zKillboard API format
Closes #872
2017-10-01 12:53:03 -04:00
iAddz
4556a0e740 SRP QOL + Validation (#786)
- new UI for srp management (mass performs, inline editing)
- unique validation for srp killboard links
- character auth ownership verification for killboard links
- removed remnants of old error messaging system & replaced with current
standard
 - added a confirmation popup when deleting fleet SRP's
2017-05-03 16:55:10 -04:00
Basraah
fd05eff5d4 Add missing trailing slash in API URL 2017-02-20 12:01:37 +10:00
Adarnof
8c82897a92 Support static blue corps and alliances (#708) 2017-02-11 22:05:32 -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
5738b015c3 Correct typo in exception handling 2017-01-23 23:28:55 -05:00
Adarnof
e8915b84e5 Get ship type name from ESI
Closes #631
2017-01-11 21:58:20 -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
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
b651ebed87 Discord bot requests administrator role.
Seeing as Discord can't get their roles system to work over the API, this is our only choice.
Closes #569
2016-11-13 17:18:26 -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
Basraah
2d3055480c Fix users cannot delete mumble account (#567)
Added helper method for checking a user exists
Added a check for already deleted mumble accounts
2016-11-01 23:25:55 -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
f9dd03dc0f Handle NoneType iteration errors on empty fleetup result.
Closes #558
2016-10-26 00:24:45 +00:00
Adarnof
6d2036e84b Prevent errors when deleting users before joining TS3
Closes #554
2016-10-25 22:08:28 +00:00
Adarnof
00341f8a50 Delay new Discourse user group sync to allow request to complete.
Ensures Discourse creates user model to avoid 404s when calling API.
2016-10-25 21:59:58 +00:00
Adarnof
5ee65706cb Correct discourse login for non-superusers.
Correct TS3 error handling.
Closes #554
2016-10-25 21:12:23 +00:00
Adarnof
4ff21b25c3 Discourse SSO (#560)
* Alter Discourse support to act as SSO provider.
Correct service group sync retry queueing.

* Correct default database enviroment variable names.

* Redirect to requested page after succesful login.

* Correct default redirect handling.
Correct attribute used to logout users on Discourse.
Improve logging messages to use parsed path on Discourse.

* Correct task retry syntax using bind=True.
Inherit from base exception so can catch TeamspeakErrors.
2016-10-25 14:52:12 -04:00
Adarnof
1daf77709d Abort API refresh when API servers unreachable.
Sorry aboot today.
2016-10-21 20:39:00 -04:00
Adarnof
deb94c06fd prevent error being raised on OK empty response
closes #554
2016-10-18 13:45:15 -04:00
Adarnof
e242b8cfec correct dict unpacking of escape characters
closes #554
2016-10-18 13:16:17 -04:00
Adarnof
90d88c4598 avoid keyerror when determining groups to remove 2016-10-18 00:43:28 -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
moriartyj
812268211c Added Discord nickname syncing with EVE alliance character name (#525) 2016-09-03 23:13:54 -04:00
Adarnof
b0c41598cf limit usernames to 30 characters 2016-08-10 18:40:06 -04:00
Adarnof
f119d06956 limit usernames to 30 characters 2016-08-10 18:39:31 -04:00
Csaba Turek
319567f1ac "update authorization header" fix (#514) 2016-08-06 17:23:21 -04:00
Adarnof
9435db4a32 update authorization header
include token_type as required by recent API changes
2016-08-05 22:58:08 -04:00
Adarnof
eeea5ce14e capture error code on user deletion issues
addresses #501
2016-07-11 15:33:32 +00:00
Adarnof
e0693e7ca8 use 404 to test user not on server 2016-06-15 21:42:26 -04:00
Adarnof
b548d8a87a initialize logger 2016-06-14 10:02:31 -04:00
Adarnof
2da3cbfb70 correct guild members endpoint url 2016-06-14 00:37:07 -04:00
Adarnof
54731d4aea correct user deletion headers 2016-06-13 10:42:19 -04:00
Adarnof
8cbfa954fa catch IndexError when getting fitting doctrine #
addresses #462
2016-06-13 10:04:57 -04:00
Adarnof
1fd423e20f Discord OAuth Integration (#468)
* Implement Discord OAuth
 - extend group caching to Discord
 - use bot token to manipulate api
 - migrate to official API
Addresses #419

* Remove virtualenv wrapper

* Discord OAuth integration playtest corrections
Closes #419
2016-06-13 00:16:27 +00:00
Meletis Flevarakis
e6b08fca88 XenForo integration initial version (#459)
* XenForo integration beta

* Removing debug loggers
2016-06-11 21:22:58 +00:00
Adarnof
842080f3de log warnings on failed connection to fleetup 2016-06-10 22:35:02 -04:00
Adarnof
020a3022f1 Handle empty responses from fleetup
Closes #413
Closes #421
2016-06-10 22:34:03 -04:00
Adarnof
94cd0b98d5 sanitize apostrophes in username
closes #442
2016-06-10 22:04:58 -04:00
Adarnof
077531fa5a retain sanitized spaces
closes #465
2016-06-10 22:03:31 -04:00
moriartyj
cce4361eeb Allows automatic update of Discord avatar to EVE avatar (#450)
* Automatic rejection of old API IDs

* Added API ID fudge factor

* Added toggle-able options for api key rejection

* Clarified ValidationError message

* Allows automatic update of Discord avatar to EVE avatar
2016-06-02 21:17:52 +00:00
Adarnof
921be2d73f sanitize single apostrophes 2016-05-11 13:11:57 -04:00
Adarnof
18b1a576d7 remove check for dictionary structure
allows exceptions to occur for logging
2016-05-09 17:50:54 -04:00
Adarnof
8a691fcd6b log TS3 errors on user creation
returns no username on failure to prevent storing empty perm key in authservicesinfo models
2016-05-09 17:03:53 -04:00
Adarnof
d59c27aba4 move data parsing to try block 2016-04-29 21:58:05 -04:00
Adarnof
09f10b383c elevate loglevel of failed pathfinder activation 2016-04-29 21:53:23 -04:00
Adarnof
1abeba5658 Merge pull request #399 from johanko/fleetup
Fleetup
2016-04-29 14:51:03 -04:00
johanko
c26f1af41c Update fleetup_manager.py 2016-04-29 10:52:09 +02:00
Adarnof
4dbf014b31 reduce loglevel of absent corp api key 2016-04-29 01:38:56 -04:00
johanko
d2865c97e1 API call time-out handling 2016-04-21 10:59:39 +00:00