mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Remaining license differentiation for activity streams.
This commit is contained in:
parent
9cc68d4da7
commit
d5a781f43e
128
awx/api/views.py
128
awx/api/views.py
@ -508,7 +508,7 @@ class OrganizationList(ListCreateAPIView):
|
||||
# if no organizations exist in the system.
|
||||
if (not feature_enabled('multiple_organizations') and
|
||||
self.model.objects.filter(active=True).count() > 0):
|
||||
raise LicenseForbids('This Tower license only permits a single '
|
||||
raise LicenseForbids('Your Tower license only permits a single '
|
||||
'organization to exist.')
|
||||
|
||||
# Okay, create the organization as usual.
|
||||
@ -566,7 +566,7 @@ class OrganizationActivityStreamList(SubListAPIView):
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_stream'):
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
@ -635,7 +635,7 @@ class TeamActivityStreamList(SubListAPIView):
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_stream'):
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
@ -718,6 +718,16 @@ class ProjectActivityStreamList(SubListAPIView):
|
||||
relationship = 'activitystream_set'
|
||||
new_in_145 = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
# Okay, let it through.
|
||||
return super(type(self), self).get(request, *args, **kwargs)
|
||||
|
||||
def get_queryset(self):
|
||||
parent = self.get_parent_object()
|
||||
self.check_parent_access(parent)
|
||||
@ -851,6 +861,16 @@ class UserActivityStreamList(SubListAPIView):
|
||||
relationship = 'activitystream_set'
|
||||
new_in_145 = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
# Okay, let it through.
|
||||
return super(type(self), self).get(request, *args, **kwargs)
|
||||
|
||||
def get_queryset(self):
|
||||
parent = self.get_parent_object()
|
||||
self.check_parent_access(parent)
|
||||
@ -907,6 +927,16 @@ class CredentialActivityStreamList(SubListAPIView):
|
||||
relationship = 'activitystream_set'
|
||||
new_in_145 = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
# Okay, let it through.
|
||||
return super(type(self), self).get(request, *args, **kwargs)
|
||||
|
||||
class PermissionDetail(RetrieveUpdateDestroyAPIView):
|
||||
|
||||
model = Permission
|
||||
@ -955,6 +985,16 @@ class InventoryActivityStreamList(SubListAPIView):
|
||||
relationship = 'activitystream_set'
|
||||
new_in_145 = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
# Okay, let it through.
|
||||
return super(type(self), self).get(request, *args, **kwargs)
|
||||
|
||||
def get_queryset(self):
|
||||
parent = self.get_parent_object()
|
||||
self.check_parent_access(parent)
|
||||
@ -1059,6 +1099,16 @@ class HostActivityStreamList(SubListAPIView):
|
||||
relationship = 'activitystream_set'
|
||||
new_in_145 = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
# Okay, let it through.
|
||||
return super(type(self), self).get(request, *args, **kwargs)
|
||||
|
||||
def get_queryset(self):
|
||||
parent = self.get_parent_object()
|
||||
self.check_parent_access(parent)
|
||||
@ -1267,6 +1317,16 @@ class GroupActivityStreamList(SubListAPIView):
|
||||
relationship = 'activitystream_set'
|
||||
new_in_145 = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
# Okay, let it through.
|
||||
return super(type(self), self).get(request, *args, **kwargs)
|
||||
|
||||
def get_queryset(self):
|
||||
parent = self.get_parent_object()
|
||||
self.check_parent_access(parent)
|
||||
@ -1543,6 +1603,16 @@ class InventorySourceActivityStreamList(SubListAPIView):
|
||||
relationship = 'activitystream_set'
|
||||
new_in_145 = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
# Okay, let it through.
|
||||
return super(type(self), self).get(request, *args, **kwargs)
|
||||
|
||||
class InventorySourceHostsList(SubListAPIView):
|
||||
|
||||
model = Host
|
||||
@ -1744,6 +1814,16 @@ class JobTemplateActivityStreamList(SubListAPIView):
|
||||
relationship = 'activitystream_set'
|
||||
new_in_145 = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
# Okay, let it through.
|
||||
return super(type(self), self).get(request, *args, **kwargs)
|
||||
|
||||
class JobTemplateCallback(GenericAPIView):
|
||||
|
||||
model = JobTemplate
|
||||
@ -1989,6 +2069,16 @@ class JobActivityStreamList(SubListAPIView):
|
||||
relationship = 'activitystream_set'
|
||||
new_in_145 = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
# Okay, let it through.
|
||||
return super(type(self), self).get(request, *args, **kwargs)
|
||||
|
||||
class JobStart(GenericAPIView):
|
||||
|
||||
model = Job
|
||||
@ -2579,6 +2669,16 @@ class AdHocCommandActivityStreamList(SubListAPIView):
|
||||
relationship = 'activitystream_set'
|
||||
new_in_220 = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
# Okay, let it through.
|
||||
return super(type(self), self).get(request, *args, **kwargs)
|
||||
|
||||
|
||||
class SystemJobList(ListCreateAPIView):
|
||||
|
||||
@ -2670,12 +2770,34 @@ class ActivityStreamList(SimpleListAPIView):
|
||||
serializer_class = ActivityStreamSerializer
|
||||
new_in_145 = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
# Okay, let it through.
|
||||
return super(type(self), self).get(request, *args, **kwargs)
|
||||
|
||||
|
||||
class ActivityStreamDetail(RetrieveAPIView):
|
||||
|
||||
model = ActivityStream
|
||||
serializer_class = ActivityStreamSerializer
|
||||
new_in_145 = True
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
# Sanity check: Does this license allow activity streams?
|
||||
# If not, forbid this request.
|
||||
if not feature_enabled('activity_streams'):
|
||||
raise LicenseForbids('Your license does not allow use of '
|
||||
'the activity stream.')
|
||||
|
||||
# Okay, let it through.
|
||||
return super(type(self), self).get(request, *args, **kwargs)
|
||||
|
||||
|
||||
# Create view functions for all of the class-based views to simplify inclusion
|
||||
# in URL patterns and reverse URL lookups, converting CamelCase names to
|
||||
# lowercase_with_underscore (e.g. MyView.as_view() becomes my_view).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user