Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
arturo-seijas committed Mar 4, 2024
1 parent 6b0dd8d commit e556b92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Allow domains module."""

# pylint:disable=imported-auth-user
# pylint:disable=duplicate-code,imported-auth-user

from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError

from httprequest_lego_provider.forms import FQDN_PREFIX
from httprequest_lego_provider.models import Domain, DomainUserPermission

# pylint:disable=duplicate-code


class Command(BaseCommand):
"""Command to revoke access to domains to an user.
Expand Down Expand Up @@ -43,7 +46,7 @@ def handle(self, *args, **options):
except User.DoesNotExist as exc:
raise CommandError(f'User "{username}" does not exist') from exc
for domain_name in domains:
domain, _ = Domain.objects.get_or_create(fqdn=f"_acme-challenge.{domain_name}")
domain, _ = Domain.objects.get_or_create(fqdn=f"{FQDN_PREFIX}{domain_name}")
DomainUserPermission.objects.filter(domain=domain, user=user).delete()

self.stdout.write(self.style.SUCCESS(f'Revoked "{domains}" for "{username}"'))

0 comments on commit e556b92

Please sign in to comment.