fix analytics permissions (#1608)

main
Andrey Zhavoronkov 6 years ago committed by GitHub
parent 7621d2b35d
commit e21ec568fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- A problem with mask to polygons conversion when polygons are too small (<https://github.com/opencv/cvat/pull/1581>) - A problem with mask to polygons conversion when polygons are too small (<https://github.com/opencv/cvat/pull/1581>)
- Unable to upload video with uneven size (<https://github.com/opencv/cvat/pull/1594>) - Unable to upload video with uneven size (<https://github.com/opencv/cvat/pull/1594>)
- Fixed an issue with `z_order` having no effect on segmentations (<https://github.com/opencv/cvat/pull/1589>) - Fixed an issue with `z_order` having no effect on segmentations (<https://github.com/opencv/cvat/pull/1589>)
- Permission group whitelist check for analytics view (<https://github.com/opencv/cvat/pull/1608>)
### Security ### Security
- -

@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.

@ -1,3 +0,0 @@
from django.db import models
# Create your models here.

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

@ -1,5 +1,5 @@
# Copyright (C) 2018 Intel Corporation # Copyright (C) 2018-2020 Intel Corporation
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
@ -9,4 +9,3 @@ from . import views
urlpatterns = [ urlpatterns = [
path('<path:path>', views.LogViewerProxy.as_view()) path('<path:path>', views.LogViewerProxy.as_view())
] ]

@ -1,3 +1,7 @@
# Copyright (C) 2018-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
import os import os
from revproxy.views import ProxyView from revproxy.views import ProxyView
@ -20,3 +24,8 @@ class LogViewerProxy(PermissionRequiredMixin, ProxyView):
headers['X-Forwarded-User'] = headers['REMOTE_USER'] headers['X-Forwarded-User'] = headers['REMOTE_USER']
return headers return headers
# Returns True if the user has any of the specified permissions
def has_permission(self):
perms = self.get_permission_required()
return any(self.request.user.has_perm(perm) for perm in perms)

Loading…
Cancel
Save