Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Example Dependency Error] Add auth service to sudo #11

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
7 changes: 7 additions & 0 deletions src/sudo/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from django.contrib.auth.models import AnonymousUser
from django.utils.translation import gettext_lazy as _

from sentry.auth.services.access.service import access_service


class SudoForm(forms.Form):
"""
Expand All @@ -26,6 +28,11 @@ class SudoForm(forms.Form):

def __init__(self, user: AnonymousUser | AbstractBaseUser, *args: Any, **kwargs: Any) -> None:
self.user = user
self.auth_state = access_service.get_user_auth_state(
user_id=user.id,
is_superuser=user.is_superuser,
is_staff=user.is_staff,
)
super().__init__(*args, **kwargs)

def clean_password(self) -> str:
Expand Down