mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 04:47:44 -02:30
clears authtoken & add PAT
This commit is contained in:
@@ -25,6 +25,10 @@ from awx.main.models.label import * # noqa
|
||||
from awx.main.models.workflow import * # noqa
|
||||
from awx.main.models.channels import * # noqa
|
||||
from awx.api.versioning import reverse
|
||||
from awx.main.models.oauth import * # noqa
|
||||
|
||||
from oauth2_provider.models import Grant # noqa
|
||||
|
||||
|
||||
# Monkeypatch Django serializer to ignore django-taggit fields (which break
|
||||
# the dumpdata command; see https://github.com/alex/django-taggit/issues/155).
|
||||
@@ -115,21 +119,20 @@ def user_is_in_enterprise_category(user, category):
|
||||
User.add_to_class('is_in_enterprise_category', user_is_in_enterprise_category)
|
||||
|
||||
|
||||
from oauth2_provider.models import Application, Grant, AccessToken, RefreshToken # noqa
|
||||
|
||||
|
||||
def oauth_application_get_absolute_url(self, request=None):
|
||||
return reverse('api:user_me_oauth_application_detail', kwargs={'pk': self.pk}, request=request)
|
||||
def o_auth2_application_get_absolute_url(self, request=None):
|
||||
return reverse('api:o_auth2_application_detail', kwargs={'pk': self.pk}, request=request)
|
||||
|
||||
|
||||
Application.add_to_class('get_absolute_url', oauth_application_get_absolute_url)
|
||||
OAuth2Application.add_to_class('get_absolute_url', o_auth2_application_get_absolute_url)
|
||||
|
||||
|
||||
def oauth_token_get_absolute_url(self, request=None):
|
||||
return reverse('api:user_me_oauth_token_detail', kwargs={'pk': self.pk}, request=request)
|
||||
def o_auth2_token_get_absolute_url(self, request=None):
|
||||
return reverse('api:o_auth2_token_detail', kwargs={'pk': self.pk}, request=request)
|
||||
|
||||
|
||||
AccessToken.add_to_class('get_absolute_url', oauth_token_get_absolute_url)
|
||||
OAuth2AccessToken.add_to_class('get_absolute_url', o_auth2_token_get_absolute_url)
|
||||
|
||||
|
||||
# Import signal handlers only after models have been defined.
|
||||
@@ -162,8 +165,8 @@ activity_stream_registrar.connect(User)
|
||||
activity_stream_registrar.connect(WorkflowJobTemplate)
|
||||
activity_stream_registrar.connect(WorkflowJobTemplateNode)
|
||||
activity_stream_registrar.connect(WorkflowJob)
|
||||
activity_stream_registrar.connect(Application)
|
||||
activity_stream_registrar.connect(AccessToken)
|
||||
activity_stream_registrar.connect(OAuth2Application)
|
||||
activity_stream_registrar.connect(OAuth2AccessToken)
|
||||
|
||||
# prevent API filtering on certain Django-supplied sensitive fields
|
||||
prevent_search(User._meta.get_field('password'))
|
||||
|
||||
Reference in New Issue
Block a user