diff --git a/cvat-core/src/server-proxy.ts b/cvat-core/src/server-proxy.ts
index 156f1f28ba38..d2e337af2d68 100644
--- a/cvat-core/src/server-proxy.ts
+++ b/cvat-core/src/server-proxy.ts
@@ -291,14 +291,20 @@ class ServerProxy {
const { backendAPI } = config;
let response = null;
try {
- response = await Axios.get(`${backendAPI}/restrictions/user-agreements`, {
+ response = await Axios.get(`${backendAPI}/user-agreements`, {
proxy: config.proxy,
+ validateStatus: (status) => status === 200 || status === 404,
});
+
+ if (response.status === 200) {
+ return response.data;
+ }
+
+ return [];
} catch (errorData) {
+
throw generateError(errorData);
}
-
- return response.data;
}
async function register(username, firstName, lastName, email, password1, password2, confirmations) {
diff --git a/cvat-ui/src/components/register-page/register-form.tsx b/cvat-ui/src/components/register-page/register-form.tsx
index b81e3f91ceda..c1972b5ba5ba 100644
--- a/cvat-ui/src/components/register-page/register-form.tsx
+++ b/cvat-ui/src/components/register-page/register-form.tsx
@@ -90,7 +90,7 @@ const validateAgreement: ((userAgreements: UserAgreement[]) => RuleRender) = (
const [agreement] = userAgreements
.filter((userAgreement: UserAgreement): boolean => userAgreement.name === name);
if (agreement.required && !value) {
- return Promise.reject(new Error(`You must accept ${agreement.displayText} to continue!`));
+ return Promise.reject(new Error(`You must accept ${agreement.urlDisplayText} to continue!`));
}
return Promise.resolve();
@@ -252,10 +252,12 @@ function RegisterFormComponent(props: Props): JSX.Element {
]}
>
- I read and accept the
-
- {` ${userAgreement.displayText}`}
-
+ {userAgreement.textPrefix}
+ {!!userAgreement.url &&
+
+ {` ${userAgreement.urlDisplayText}`}
+
+ }
))}
diff --git a/cvat-ui/src/reducers/index.ts b/cvat-ui/src/reducers/index.ts
index acbd52454b75..5926941d8b1e 100644
--- a/cvat-ui/src/reducers/index.ts
+++ b/cvat-ui/src/reducers/index.ts
@@ -277,8 +277,9 @@ export interface AboutState {
export interface UserAgreement {
name: string;
- displayText: string;
+ urlDisplayText: string;
url: string;
+ textPrefix: string;
required: boolean;
}
diff --git a/cvat/apps/engine/urls.py b/cvat/apps/engine/urls.py
index aa2537a04c77..67a0ceadeb93 100644
--- a/cvat/apps/engine/urls.py
+++ b/cvat/apps/engine/urls.py
@@ -9,7 +9,6 @@
from django.views.generic import RedirectView
from django.conf import settings
-from cvat.apps.restrictions.views import RestrictionsViewSet
from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView
@@ -21,7 +20,6 @@
router.register('server', views.ServerViewSet, basename='server')
router.register('issues', views.IssueViewSet)
router.register('comments', views.CommentViewSet)
-router.register('restrictions', RestrictionsViewSet, basename='restrictions')
router.register('cloudstorages', views.CloudStorageViewSet)
urlpatterns = [
diff --git a/cvat/apps/iam/rules/restrictions.csv b/cvat/apps/iam/rules/restrictions.csv
deleted file mode 100644
index c542bfcf0db7..000000000000
--- a/cvat/apps/iam/rules/restrictions.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-Scope,Resource,Context,Ownership,Limit,Method,URL,Privilege,Membership
-view:user-agreements,N/A,N/A,N/A,,POST,/restrictions/user-agreements,N/A,N/A
-view:terms-of-use,N/A,N/A,N/A,,GET,/restrictions/terms-of-use,N/A,N/A
\ No newline at end of file
diff --git a/cvat/apps/restrictions/__init__.py b/cvat/apps/restrictions/__init__.py
deleted file mode 100644
index eed408493991..000000000000
--- a/cvat/apps/restrictions/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-# Copyright (C) 2020-2022 Intel Corporation
-#
-# SPDX-License-Identifier: MIT
diff --git a/cvat/apps/restrictions/apps.py b/cvat/apps/restrictions/apps.py
deleted file mode 100644
index 0d05194af464..000000000000
--- a/cvat/apps/restrictions/apps.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (C) 2020-2022 Intel Corporation
-#
-# SPDX-License-Identifier: MIT
-
-
-from django.apps import AppConfig
-
-
-class RestrictionsConfig(AppConfig):
- name = 'cvat.apps.restrictions'
diff --git a/cvat/apps/restrictions/serializers.py b/cvat/apps/restrictions/serializers.py
deleted file mode 100644
index ca9eb2a7ceef..000000000000
--- a/cvat/apps/restrictions/serializers.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (C) 2020-2022 Intel Corporation
-#
-# SPDX-License-Identifier: MIT
-
-
-from rest_framework import serializers
-from django.conf import settings
-
-from cvat.apps.iam.serializers import RegisterSerializerEx
-
-class UserAgreementSerializer(serializers.Serializer):
- name = serializers.CharField(max_length=256)
- display_text = serializers.CharField(max_length=2048, default='')
- url = serializers.CharField(max_length=2048, default='')
- required = serializers.BooleanField(default=False)
- value = serializers.BooleanField(default=False)
-
- # pylint: disable=no-self-use
- def to_representation(self, instance):
- instance_ = instance.copy()
- instance_['displayText'] = instance_.pop('display_text')
- return instance_
-
-class RestrictedRegisterSerializer(RegisterSerializerEx):
- confirmations = UserAgreementSerializer(many=True, required=False)
-
- def validate(self, data):
- validated_data = super().validate(data)
- server_user_agreements = settings.RESTRICTIONS['user_agreements']
- for server_agreement in server_user_agreements:
- if server_agreement['required']:
- is_confirmed = False
- for confirmation in validated_data['confirmations']:
- if confirmation['name'] == server_agreement['name'] \
- and confirmation['value']:
- is_confirmed = True
-
- if not is_confirmed:
- raise serializers.ValidationError(
- 'Agreement {} must be accepted'.format(server_agreement['name'])
- )
-
- return validated_data
diff --git a/cvat/apps/restrictions/templates/restrictions/terms_of_use.html b/cvat/apps/restrictions/templates/restrictions/terms_of_use.html
deleted file mode 100644
index 63bf28c5622b..000000000000
--- a/cvat/apps/restrictions/templates/restrictions/terms_of_use.html
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
- CVAT terms of use
-
- PLEASE READ THE FOLLOWING TERMS CAREFULLY. IF YOU CLICK TO ACCEPT THIS AGREEMENT, DOWNLOAD,
- OR INSTALL THE CVAT SOFTWARE, YOU ARE AGREEING TO BE LEGALLY BOUND BY THIS AGREEMENT
- IN ADDITION TO ANY OTHER TERMS PROVIDED. IF YOU DO NOT AGREE TO THESE TERMS, DO NOT USE
- THE CVAT SOFTWARE AND DESTROY ALL COPIES IN YOUR POSSESSION.
-
-
- You understand and acknowledge that you are responsible for your use of the CVAT Software
- and any content which you may alter with use of the CVAT Software.
-
-
- You further understand and acknowledge that any content you may elect to use may be subject to privacy,
- data and intellectual property rights and that you are responsible to your compliance with such laws and regulations.
-
-
-