Alliance Auth Plugin
Project description
WIP PLACEHOLDER
rest soon(tm) code in another day or so...
Secure Groups
Plugin for Auto Group Bot Stuffs for Alliance Auth.
Features
- Manual Groups, either auto add or still request add via Auths Built in Group Management system.
- Auto Groups, process all members for a filter and add who ever passes.
- A Grace on failure when already in the group system
- Pings to users on discord and in auth when they are removed
- Smart Group Filters included with this app:
- Alt in Alliance on account
- Alt in Corp on account
Apps that provide a filter
Not in any particular order:
- Corptools ( link here )
- Assets on account
- skills on account
- some others i forget ATM
- zkill module ( link )
- Kills in time period
- Blacklist module ( link )
- users has no flags or has or has never had blacklisted chars
Third Party Filters!
This is the most minimal requirements and may in places be a bit pseudo currently
The core premise of this module is to allow any 3rd party app add a filter to the options. This is achieved using a model from your app.
The "Key Model Assumptions" are as follows;
- Your model Must Have:
name
fielddescription
fieldprocess_filter
function
process_filter
will check the account of theuser
passed in relative to your apps data.process_filter
will always return a boolean, and NEVER throw exception.user
will be an auth user model ( add a link )
The process is essentialy as follows;
Create a filter model "Filter Model"
My base filter is as follows. This is the most minimal requirements and may in places be a bit pseudo currently
class BaseFilter(models.Model):
name = models.CharField(max_length=500) # This is the filters name shown to the admin
description = models.CharField(max_length=500) # this is what is shown to the user
class Meta:
abstract = True
def __str__(self):
return f"{self.name}: {self.description}"
def process_filter(self, user: User): # this is the check run against a users characters
return NotImplemented("Please Create a filter!")
Now you create your filter! EG. A filter for checking if a users has a alt in a specific corp could look a little like this;
class ExampleAltCorpFilter(FilterBase):
alt_corp = models.ForeignKey(EveCorporationInfo, on_delete=models.CASCADE)
def process_filter(self, user: User):
try:
character_list = user.character_ownerships.all().select_related('character')
character_count = character_list.filter(character__corporation_id=self.alt_corp.altcorp_id).count()
if character_count > 0:
return True
else:
return False
except:
return False
Add your new filter model to the admin site
it would look a little like this in our continuing example
class ExampleAltCorpAdmin(admin.ModelAdmin):
raw_id_fields = ['alt_corp']
admin.site.register(ExampleAltCorpFilter, ExampleAltCorpAdmin)
Add hooks for your filter models
The magic happens by using a GenericForeignKey in this app to access your models in your app. You have to tell us about your apps filters for them to work, [here is how i manage the ones in this app.](Link to the repo signals file)
Continuing with the above example. for the hooks in your auth_hooks.py
from .models import ExampleAltCorpFilter, ExampleOtherFilter, SomeOtherFilter
@hooks.register('secure_group_filters') # this is the critical name we are searching for.
def filters(): # can be any name
return [ExampleAltCorpFilter, ExampleOtherFilter, SomeOtherFilter] # pass in the model classes as an array.
This will keep us all in sync and we can start using the filter! in a smart group, if you app goes away or a filter becomes obsolete it will simply be ignored till it returns or is deleted in admin.
Screenshots
TODO: MAKE NEW SCREENSHOTS!
users display demo
discord message example
admin demo
Issues
Please remember to report any Group Bot related issues using the issues on this repository.
Contributing
Make sure you have signed the License Agreement by logging in at https://developers.eveonline.com before submitting any pull requests. All bug fixes or features must not include extra superfluous formatting changes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for allianceauth-securegroups-0.0.1a1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5c7e31636b806835e713734ee6cea77a6c99b46d80fe133ea3643b62488190c |
|
MD5 | 6fc63319482070f43def1039899a0d21 |
|
BLAKE2b-256 | 741e743a86584f0cf3bd16cba134d3ded4f1baac066f9a90719a0cd1fcab6cd4 |