80 Commits

Author SHA1 Message Date
Adarnof
5ce5f37867 Periodic checks of character ownership hashes.
Fix migration naming from merge.
2017-09-17 02:31:46 -04:00
Adarnof
c1547cab8b Fix that state deletion bug. Thanks @basraah
Also sets state to guest on inactivation, and reassesses on reactivation. With a unit test to boot!
2017-09-06 23:00:12 -04:00
Adarnof
3c90868338 Correct available states query for character models missing field data
Ensure state_changed signals are sent
Speed up authentication unit tests
Add authentication unit test for state public availability change
2017-08-11 17:34:43 -04:00
Adarnof
84b1ddc5d9 Enhance admin site.
Regroup auth models.
2017-06-30 17:57:29 -04:00
Adarnof
a235254e48 A whole bunch of unit tests. 2017-06-15 23:01:15 -04:00
Adarnof
dd3a3e1081 Fix service migration 2017-06-14 00:32:39 -04:00
Adarnof
23bfc3d34a Correct main character reset on token invalidation.
Correct interpretation of missing SERVICES_MIGRATED setting.
Remove legacy api sync celerybeat scheduled task.
2017-06-13 20:34:39 -04:00
Adarnof
97fe2ddfd0 Move templates and urls to apps.
Implement url hooks.
Many apps are now removable.
Default to assuming services have been migrated.
2017-06-07 22:49:46 -04:00
Adarnof
d51848aa50 Minor corrections from merge. 2017-06-06 21:47:51 -04:00
Adarnof
00cc89d71c Merge branch 'master' of https://github.com/Adarnof/allianceauth into custom_user
# Conflicts:
#	alliance_auth/settings.py.example
#	eveonline/views.py

Fix some tests.
2017-05-27 18:34:59 -04:00
Adarnof
f0f1b21226 Begin fixing tests.
Use custom django-navhelper
2017-04-05 00:10:05 -04:00
Adarnof
26405985a2 Change background image.
Remove legacy index.html link images.
2017-03-27 16:17:35 -04:00
Adarnof
aaf196b477 Apply username sanitizing upon creation
Prevent purging of character ownerships when logging in
Listen to state permission changes for service access verification
2017-03-26 17:45:32 -04:00
Adarnof
c6699686ad Prevent altering user states on admin site 2017-03-25 20:19:44 -04:00
Adarnof
64e7c6093e Remove references to legacy is_blue attributes
Provide simple EVE model creation forms with ID, populate the rest from providers
Correct handling of non-main characters in signals
2017-03-25 17:59:38 -04:00
Adarnof
13b0dbc960 Restructure settings.py.example
Add help text to State model
Remove navbar group headings
Fix registration email pluralization
Group memberships on state admin page
Attempt to prevent resetting of state if set on profile admin manually
Embed readthedocs on help page
Rename CorpStats API Index to Registration Index
Default corputils view to main character's corp if available
Correct Application characters listing
Correct string coercion of optimers
Improve readability of SRP values with intcomma
Beautify tables by embeding in panels
Replace slugify with py3-friendly python-slugify
2017-03-25 16:28:26 -04:00
Adarnof
963cecb365 Fix registration.
Fix state assignment.
Fix character ownership transfer.
Disable non-staff passwords.
Fix dashboard groups panel placement.
Fix corpstats viewmodel retrieval.
2017-03-24 19:50:50 -04:00
Adarnof
ab10f062f7 Correct migration syntax. 2017-03-24 10:03:56 -04:00
Adarnof
e15d79b834 Bulk of the profile work is done. 2017-03-23 22:54:25 -04:00
Adarnof
bb87fdd958 temp commit 2017-02-27 18:34:16 -05:00
iAddz
a6c48f8d71 Localisation & German translation updates (#701) 2017-02-11 23:04:18 -05:00
Basraah
a33c8c14ee Grant service access by permissions (#692)
* Add service access permissions and migration

`ENABLE_AUTH_<servicename> = True` will have the new permission applied
to the settings configured `DEFAULT_AUTH_GROUP` group or `Member` if
none is configured.

`ENABLE_BLUE_<servicename> = True` will have the new permission applied
to the settings configured `DEFAULT_BLUE_GROUP` group or `Blue` if none
is configured.

* Move views and hooks to permissions based access

* Remove access restriction to services view

Hypothetically non-member/blues could be granted permission to access
services manually as desired now. A user that has no permissions to
access any services will see a blank services list.

* Remove obsolete service settings

* Remove references to obsolete settings

* Adjusted tests to support permissions based access

* Fix incorrectly named permissions

* Add simple get_services generator function

* Added signals for user and groups perm changes

* Update validate_services to support permissions

deactivate_services removed as its surplus to requirements.

* Removed state parameter from validate_services calls

* Update tests to support signals changes

* Fix incorrect call to validate_services task

* Fix validate_services and test

* Add validate_user to changed user groups signal

* Added tests for new signals

* Remove unnecessary post_add signals

* Added documentation for service permissions

* Added detection for members with service active

If there are any service users in the Member or Blue groups active, then
the permission will be added to the respective Member or Blue group.
This means its no longer necessary to maintain the service enablesettings to migrate to permissions based service.

Remove obsolete state based status checking
2017-02-11 22:51:30 -05:00
Basraah
918ecf812c Publically joinable Groups (#697)
* Add public field to AuthGroup

* Add permission for users to join non-public groups

By default this permission will be applied to the "Member" group to
maintain the current behaviour.

* Allow users to join public groups

Users without the 'groupmanagement.request_groups' permission will be
able to join groups marked as public but will not be able to see or join
any other groups.

* Prevent None state change from purging groups

Currently when a user drops from Blue or Member state all groups and
permissions are discarded. This softens that approach by not removing
public groups and creates a distinction between the two activities. An
argument could maybe be made for not removing permissions on a state
change, but that is beyond the scope of this change.

* Correct syntax for removing filtered groups

* Add unit tests for disable user and member

* Update services signals tests

* Correct mocking call

* Remove permissions checking from menu item
2017-02-11 22:03:39 -05:00
Basraah
aa0148f23b Services Modules migration improvements (#676)
* Added a check to prevent dataloss from missing service modules

Migration will raise an exception and refuse to run if a model has data
for a field which is missing its target service.

* Add setting to allow services to be installed after service migration

Previously django would complain about migrations being out of order. By
setting `SERVICES_MIGRATED=True` the
`authentication.0013_service_modules` migration drops all of its
'optional' dependencies which allows the initial migrations of service
modules to run normally. If the setting is missing or set to False, the
migration will require all installed and required services migrations to
have run before the `authentication.0013_service_modules` migration.

* Move setting to somewhere it makes more sense

* Modify celerybeat registration to automatically register services
2017-01-28 18:15:58 +10: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
6c4e8ec2d1 Ensure correct corp and alliance groups are assigned.
Closes #650
2017-01-15 22:49:33 -05:00
Adarnof
df02982983 Login newly registered users.
Closes #642
2017-01-14 02:28:13 -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
8e64fe145e Correct state migration for multitenant 2017-01-05 23:51:49 -05:00
Adarnof
395c2c1bec Correct ID type mismatch on API key refresh. 2017-01-05 00:43:52 -05:00
Adarnof
2f5529b582 Remove refernces to optional SSO configuration 2016-12-29 18:34:21 -05:00
Adarnof
04f2731517 Multitenant
Closes #604
2016-12-29 18:10:43 -05:00
Adarnof
71c1054328 EVE Swagger Interface
Closes #591

Conflicts:
	authentication/views.py
	eveonline/views.py
	stock/templates/public/characternotexisting.html
2016-12-29 17:53:33 -05:00
Adarnof
03aab76ab9 Group system overhaul
Closes #588
2016-12-29 17:42:10 -05:00
Adarnof
2f2c2bd0e5 Complete removal of single tenant aspects. 2016-12-20 07:17:21 +00:00
Adarnof
0fe5a1c5e3 Correct context processor for SSO address. 2016-12-16 17:43:44 -05:00
Adarnof
a630b5b397 Migrate to adarnauth-esi 2016-12-11 20:11:05 -05:00
Basraah
9eba5607d2 Consolidate member state checking for easier code reuse 2016-12-05 20:42:47 +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
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
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
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
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
Meletis Flevarakis
e6b08fca88 XenForo integration initial version (#459)
* XenForo integration beta

* Removing debug loggers
2016-06-11 21:22:58 +00:00
Mr McClain
5025ab8ffe Pathfinder Integration (#394)
tested and working
2016-04-17 15:02:50 -05:00
Adarnof
e29c1d3295 Discourse (#377)
* Initial work on Discourse integration

* Views for discourse

* Discourse group updates
Correct password display

* Removed password functions
Changed delete to suspend user forever
Added unsuspend check to add_user
2016-04-17 14:17:32 -05:00
Mr McClain
6f8e478baf Evernus Alliance Market Integration (#369)
* Added SMF Forum Support

* removed comment

* Fixed bugs.

* removed unused SQL statement

* Fixed Grammer in debug code

* Fixed Null Bug

* Update operationmanagement.html

* fixed bug

* fixed error

* Users now show up on the posts correctly

* Evernus Alliance Market Integration

* removed duplicate function

* empty string handling
2016-04-07 20:46:14 -05:00
Mr McClain
cfe0e23430 SMF Forum Integration
* Added SMF Forum Support

* removed comment

* Fixed bugs.

* removed unused SQL statement

* Fixed Grammer in debug code

* Fixed Null Bug

* Update operationmanagement.html

* fixed bug

* fixed error

* Users now show up on the posts correctly
2016-04-06 20:32:02 -05:00
orbitroom
75459361dc Added IP Board 4 2016-03-30 04:04:14 -05:00
orbitroom
9d6cbb325b Fixed logout logging to show actual user 2016-02-07 09:45:04 -05:00