mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 02:01:01 -03:30
Add EULA and EULA acceptance on the config endpoint
This commit is contained in:
@@ -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.
|
* `time_zone`: The configured time zone for the server.
|
||||||
* `license_info`: Information about the current license.
|
* `license_info`: Information about the current license.
|
||||||
* `version`: Version of Ansible Tower package installed.
|
* `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
|
(_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
|
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
20
awx/api/templates/eula.md
Normal 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 PERSON’S OR ENTITY’S BEHALF.
|
||||||
@@ -23,6 +23,7 @@ from django.utils.datastructures import SortedDict
|
|||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
from django.template.loader import render_to_string
|
||||||
|
|
||||||
# Django REST Framework
|
# Django REST Framework
|
||||||
from rest_framework.authtoken.views import ObtainAuthToken
|
from rest_framework.authtoken.views import ObtainAuthToken
|
||||||
@@ -183,6 +184,7 @@ class ApiV1ConfigView(APIView):
|
|||||||
license_info=license_data,
|
license_info=license_data,
|
||||||
version=get_awx_version(),
|
version=get_awx_version(),
|
||||||
ansible_version=get_ansible_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
|
# If LDAP is enabled, user_ldap_fields will return a list of field
|
||||||
@@ -205,6 +207,11 @@ class ApiV1ConfigView(APIView):
|
|||||||
def post(self, request):
|
def post(self, request):
|
||||||
if not request.user.is_superuser:
|
if not request.user.is_superuser:
|
||||||
return Response(None, status=status.HTTP_404_NOT_FOUND)
|
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:
|
try:
|
||||||
data_actual = json.dumps(request.DATA)
|
data_actual = json.dumps(request.DATA)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
|||||||
Reference in New Issue
Block a user