74 Commits

Author SHA1 Message Date
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
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
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
a561862911 Correct TS group update on perm key refresh 2017-01-03 20:12:29 -05: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
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
04a11b113a Correct missing request arg for messages.
Correct disable_service tasks to remove password check.
Addresses #557
2016-10-21 13:04:05 +00:00
Adarnof
f3d1fc87b2 Update views.py 2016-10-17 20:21:22 -04:00
Adarnof
31d454b1d2 include missing request args for messages 2016-10-17 19:59:39 -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
moriartyj
11572fc09d fixed debug message (#509) 2016-07-29 11:51:33 -04:00
moriartyj
7e4d411685 Changed timerboard to Future/Past timers (#503) 2016-07-18 14:07:22 -04:00
moriartyj
cb3dd1f393 Mumble uses alliance ticker for BLUES (#479)
* Mumble uses alliance ticker for BLUES

* Move alliance ticker section for blues

* Fixed Reviewer translated link
2016-06-26 10:18:48 -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
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
Mr McClain
10090bce79 fixed error in syntax 2016-04-17 15:59:26 -05: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
fb6fb61d61 Fixed IPS4 User deletion 2016-03-30 05:11:43 -05:00
orbitroom
4666dd748b IP board 4 Support 2016-03-30 04:40:37 -05:00
orbitroom
a18f8f7d05 Added IP Board 4 Support 2016-03-30 04:19:36 -05:00
orbitroom
75459361dc Added IP Board 4 2016-03-30 04:04:14 -05:00
Adarnof
361e4a6409 Prompt users to join TS when creating account
- will allow groups to sync
 - add button to get back to this prompt
 - do not sync groups until joined server
Closes #331
2016-03-26 03:08:28 +00:00
Adarnof
8fb5058b2f Get current model from db on service group update 2016-03-23 17:10:37 +00:00
Adarnof
a55a53239d Removed missing function reference 2016-03-23 00:04:07 +00:00
Adarnof
2db7a71e9d Removed exc_info kwarg from logger.exception statements 2016-01-31 19:42:01 +00:00
Adarnof
4612382ca1 Corrected broadcast form group field validation 2015-12-10 03:08:43 +00:00
Adarnof
ae75f60ae9 Added plaintext warning to password form.
Typo corrections.
2016-01-06 07:07:49 +00:00
Adarnof
0586f0f6d5 Custom service passwords now available.
- mumble, phpbb, ipboard, jabber
Addresses an evemail request.
2016-01-06 06:56:00 +00:00
Adarnof
b31dcb7ac0 Permission 'jabber_broadcast_all' to restrict groups
- without, can only broadcast to own groups
 - with, can broadcast to all and every group
Updated form to check request user for permission and groups when generating form
For #159
2016-01-05 23:36:17 +00:00
Adarnof
2c6ca5f273 Assign user to discordauthtoken for security
- prevents exploit of another user entering incorrect password for email yet passing validation using existing token mentioned in #146
 - does not protect against same user entering wrong password (I can live with this.)
Periodic task to remove invalid token every 2 hours
2016-01-05 22:53:52 +00:00
Adarnof
c066629864 Corrected logging errors. 2016-01-02 22:15:38 +00:00
Adarnof
b9125c3d5c Finished adding logging to service views and managers. 2015-12-30 15:29:27 +00:00
Adarnof
55fc69cf8d Basic logging for Discord account creation and database updating. 2015-12-28 06:50:13 +00:00
Adarnof
55156bf190 As per #138 only updates discord groups if user account joining succesful. 2015-12-22 05:25:28 +00:00
Adarnof
286910059b Moved syncgroup deletion into block ensuring user was deleted. 2015-12-02 03:57:54 +00:00
Adarnof
a388e2595e Cleaned up redundant functions. 2015-12-02 01:18:59 +00:00
Adarnof
8442ec1f55 Changed discord account handling. Now requests email and password and grabs UID via API.
UID is stored in authserviceinfo model and used as required.
2015-12-02 01:02:13 +00:00
Adarnof
ec1b17df25 Dissociates user account from email address when deleting service. 2015-12-01 07:56:13 +00:00
Adarnof
f6ef741e63 Added password change function as reset action. 2015-12-01 06:55:33 +00:00
Adarnof
57b44620cd Disabled Discord account reset until a proper mechanism can be thought up. 2015-12-01 06:23:18 +00:00
Adarnof
54d216bdf0 Changed how user account deletions are handled.
Now bans/unbans account as necessary.
2015-12-01 04:50:14 +00:00
Adarnof
c009420536 Included Discord in disable_services from common_task.
Changed how user accounts in discord are handled: endpoint accepts password and email.
Accounts are created with a password(random) and their user email. Need to activate account through link in email.
2015-12-01 04:12:50 +00:00
Adarnof
d3c8189c92 Corrected Discord user deletion logic.
Fixed Discord account reset.
2015-11-30 23:51:39 +00:00