Skip to content

Commit

Permalink
Basic License feature gating changes
Browse files Browse the repository at this point in the history
  • Loading branch information
beeankha authored and mabashian committed Apr 12, 2019
1 parent 58966d7 commit de34a64
Show file tree
Hide file tree
Showing 61 changed files with 125 additions and 1,015 deletions.
13 changes: 3 additions & 10 deletions awx/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@

from awx.main.validators import vars_validate_or_raise

from awx.conf.license import feature_enabled, LicenseForbids
from awx.api.versioning import reverse, get_request_version
from awx.api.fields import (BooleanNullField, CharNullField, ChoiceNullField,
VerbatimField, DeprecatedCredentialField)
Expand Down Expand Up @@ -918,7 +917,7 @@ def validate_password(self, value):
def _update_password(self, obj, new_password):
# For now we're not raising an error, just not saving password for
# users managed by LDAP who already have an unusable password set.
if getattr(settings, 'AUTH_LDAP_SERVER_URI', None) and feature_enabled('ldap'):
if getattr(settings, 'AUTH_LDAP_SERVER_URI', None):
try:
if obj.pk and obj.profile.ldap_dn and not obj.has_usable_password():
new_password = None
Expand Down Expand Up @@ -979,7 +978,7 @@ def get_related(self, obj):
return res

def _validate_ldap_managed_field(self, value, field_name):
if not getattr(settings, 'AUTH_LDAP_SERVER_URI', None) or not feature_enabled('ldap'):
if not getattr(settings, 'AUTH_LDAP_SERVER_URI', None):
return value
try:
is_ldap_user = bool(self.instance and self.instance.profile.ldap_dn)
Expand Down Expand Up @@ -1073,7 +1072,7 @@ def _is_valid_scope(self, value):
if word not in self.ALLOWED_SCOPES:
return False
return True

def validate_scope(self, value):
if not self._is_valid_scope(value):
raise serializers.ValidationError(_(
Expand Down Expand Up @@ -3170,12 +3169,6 @@ def get_field_from_model_or_attrs(fd):
def validate_extra_vars(self, value):
return vars_validate_or_raise(value)

def validate_job_slice_count(self, value):
if value > 1 and not feature_enabled('workflows'):
raise LicenseForbids({'job_slice_count': [_(
"Job slicing is a workflows-based feature and your license does not allow use of workflows."
)]})
return value

def get_summary_fields(self, obj):
summary_fields = super(JobTemplateSerializer, self).get_summary_fields(obj)
Expand Down
Loading

0 comments on commit de34a64

Please sign in to comment.