Alliance Auth Secure Groups
raw JSON → 0.10.1 verified Mon Apr 27 auth: no python
Extends Alliance Auth's group management by adding automatic filtering capabilities. Version 0.10.1, released under an active development cycle. Works by leveraging any module that provides a filter, allowing admins to define secure groups that automatically add/remove users based on conditions.
pip install allianceauth-securegroups Common errors
error ImportError: cannot import name 'SecureGroup' from 'securegroups.models' ↓
cause The model is not directly importable; it may be nested under a different module in newer versions.
fix
Use 'from securegroups.models import SecureGroup' or check the exact path in the documentation.
error django.core.exceptions.ImproperlyConfigured: 'SECUREGROUPS_FILTERS' setting is required. ↓
cause The setting is missing or misconfigured in Django settings.
fix
Add 'SECUREGROUPS_FILTERS' to your Django settings, e.g., SECUREGROUPS_FILTERS = ['securegroups.filters.my_filter'].
Warnings
breaking In version 0.10.0, the model 'SecureGroup' was moved from 'securegroups.models' to 'securegroups.models' (no change, but internal restructuring may affect custom filters). Ensure your custom filters import from the correct location. ↓
fix Update any custom filter imports to use the new module paths if needed. Refer to the changelog for details.
deprecated The 'filter' setting key 'allianceauth-securegroups' is deprecated in favor of 'SECUREGROUPS_FILTERS' in the Django settings. ↓
fix Rename the setting key to 'SECUREGROUPS_FILTERS'.
gotcha Secure Groups require the 'allianceauth' app to be properly configured with authentication modules. Without at least one auth module enabled (e.g., EveOnline), no filters will work. ↓
fix Enable at least one authentication module in Alliance Auth before using Secure Groups.
Imports
- SecureGroupAdminMixin
from securegroups.admin import SecureGroupAdminMixin - get_secure_groups_for_user
from securegroups.utils import get_secure_groups_for_user
Quickstart
import os
import django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myauth.settings')
django.setup()
from allianceauth.authentication.models import User
from securegroups.models import SecureGroup
# Ensure at least one secure group exists (run migrations first)
user = User.objects.first()
if user:
groups = SecureGroup.objects.filter(members=user)
print(f"User {user} has {groups.count()} secure groups")