Add EULA and EULA acceptance on the config endpoint

This commit is contained in:
Matthew Jones 2015-01-22 15:43:20 -05:00
parent b5a27d0a0f
commit f676d1eeeb
3 changed files with 30 additions and 1 deletions

View File

@ -10,7 +10,9 @@ the following fields (some fields may not be visible to all users):
* `time_zone`: The configured time zone for the server.
* `license_info`: Information about the current license.
* `version`: Version of Ansible Tower package installed.
* `eula`: The current End-User License Agreement
(_New in Ansible Tower 2.0.0_) Make a POST request to this resource as a super
user to install or update the existing license. The license data itself can
be POSTed as a normal json data structure.
be POSTed as a normal json data structure. The POST must include a `eula_accepted`
boolean element indicating acceptance of the End-User License Agreement.

20
awx/api/templates/eula.md Normal file
View File

@ -0,0 +1,20 @@
TOWER SOFTWARE END USER LICENSE AGREEMENT
Unless otherwise agreed to, and executed in a definitive agreement, between
Ansible, Inc. (“Ansible”) and the individual or entity (“Customer”) signing or
electronically accepting these terms of use for the Tower Software (“EULA”),
all Tower Software, including any and all versions released or made available
by Ansible, shall be subject to the Ansible Software Subscription and Services
Agreement found at www.ansible.com/subscription-agreement (“Agreement”).
Ansible is not responsible for any additional obligations, conditions or
warranties agreed to between Customer and an authorized distributor, or
reseller, of the Tower Software. BY DOWNLOADING AND USING THE TOWER SOFTWARE,
OR BY CLICKING ON THE “YES” BUTTON OR OTHER BUTTON OR MECHANISM DESIGNED TO
ACKNOWLEDGE CONSENT TO THE TERMS OF AN ELECTRONIC COPY OF THIS EULA, THE
CUSTOMER HEREBY ACKNOWLEDGES THAT CUSTOMER HAS READ, UNDERSTOOD, AND AGREES TO
BE BOUND BY THE TERMS OF THIS EULA AND AGREEMENT, INCLUDING ALL TERMS
INCORPORATED HEREIN BY REFERENCE, AND THAT THIS EULA AND AGREEMENT IS
EQUIVALENT TO ANY WRITTEN NEGOTIATED AGREEMENT BETWEEN CUSTOMER AND ANSIBLE.
THIS EULA AND AGREEMENT IS ENFORCEABLE AGAINST ANY PERSON OR ENTITY THAT USES
OR AVAILS ITSELF OF THE TOWER SOFTWARE OR ANY PERSON OR ENTITY THAT USES THE OR
AVAILS ITSELF OF THE TOWER SOFTWARE ON ANOTHER PERSONS OR ENTITYS BEHALF.

View File

@ -23,6 +23,7 @@ from django.utils.datastructures import SortedDict
from django.utils.safestring import mark_safe
from django.utils.timezone import now
from django.views.decorators.csrf import csrf_exempt
from django.template.loader import render_to_string
# Django REST Framework
from rest_framework.authtoken.views import ObtainAuthToken
@ -183,6 +184,7 @@ class ApiV1ConfigView(APIView):
license_info=license_data,
version=get_awx_version(),
ansible_version=get_ansible_version(),
eula=render_to_string("eula.md"),
)
# If LDAP is enabled, user_ldap_fields will return a list of field
@ -205,6 +207,11 @@ class ApiV1ConfigView(APIView):
def post(self, request):
if not request.user.is_superuser:
return Response(None, status=status.HTTP_404_NOT_FOUND)
if "eula_accepted" not in request.DATA:
return Response({"error": "Missing 'eula_accepted' property"}, status=status.HTTP_400_BAD_REQUEST)
if not request.DATA["eula_accepted"]:
return Response({"error": "'eula_accepted' must be True"}, status=status.HTTP_400_BAD_REQUEST)
request.DATA.pop("eula_accepted")
try:
data_actual = json.dumps(request.DATA)
except Exception, e: