def check_permissions(self, request): ret = super(WorkflowsEnforcementMixin, self).check_permissions(request) if not feature_enabled('workflows') and request.method not in ( 'GET', 'OPTIONS', 'DELETE'): raise LicenseForbids( _('Your license does not allow use of workflows.')) return ret
def check_permissions(self, request): ret = super(SystemTrackingEnforcementMixin, self).check_permissions(request) if not feature_enabled('system_tracking'): raise LicenseForbids( _('Your license does not permit use of system tracking.')) return ret
def check_permissions(self, request): ret = super(ActivityStreamEnforcementMixin, self).check_permissions(request) if not feature_enabled('activity_streams'): raise LicenseForbids( _('Your license does not allow use of the activity stream.')) return ret
def create(self, request, *args, **kwargs): """Create a new organzation. If there is already an organization and the license of this instance does not permit multiple organizations, then raise LicenseForbids. """ # Sanity check: If the multiple organizations feature is disallowed # by the license, then we are only willing to create this organization # if no organizations exist in the system. if (not feature_enabled('multiple_organizations') and self.model.objects.exists()): raise LicenseForbids( _('Your license only permits a single ' 'organization to exist.')) # Okay, create the organization as usual. return super(OrganizationList, self).create(request, *args, **kwargs)
def mock_raise_license_forbids(self, add_host=False, feature=None, check_expiration=True): raise LicenseForbids("Feature not enabled")
def mock_no_surveys(self, add_host=False, feature=None, check_expiration=True): if feature == 'surveys': raise LicenseForbids("Feature %s is not enabled in the active license." % feature) else: pass