forked from ci4s/label-studio
免登录修改
This commit is contained in:
parent
cad936255c
commit
e41aeebb6e
|
|
@ -128,3 +128,11 @@ class UpdateLastActivityMiddleware(CommonMiddleware):
|
|||
if hasattr(request, 'user') and request.method not in SAFE_METHODS:
|
||||
if request.user.is_authenticated:
|
||||
request.user.update_last_activity()
|
||||
|
||||
|
||||
class CustomHeadersMiddleware(MiddlewareMixin):
|
||||
def process_request(self, request):
|
||||
# 获取 Token
|
||||
token = "a29c0fbdea3f5d1bd5cf8cb3a3121a3bd5f9b20e"
|
||||
# 添加头部
|
||||
request.META["HTTP_AUTHORIZATION"] = f"Token {token}"
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ MIDDLEWARE = [
|
|||
'core.middleware.SetSessionUIDMiddleware',
|
||||
'core.middleware.ContextLogMiddleware',
|
||||
'core.middleware.DatabaseIsLockedRetryMiddleware',
|
||||
'core.middleware.CustomHeadersMiddleware',
|
||||
]
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
|
|
@ -341,7 +342,7 @@ BATCH_SIZE = 1000
|
|||
PROJECT_TITLE_MIN_LEN = 3
|
||||
PROJECT_TITLE_MAX_LEN = 50
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
LOGIN_URL = '/'
|
||||
LOGIN_URL = 'projects'
|
||||
MIN_GROUND_TRUTH = 10
|
||||
DATA_UNDEFINED_NAME = '$undefined$'
|
||||
LICENSE = {}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"""This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license.
|
||||
"""
|
||||
from core.settings.base import *
|
||||
|
||||
X_FRAME_OPTIONS = 'ALLOWALL'
|
||||
DJANGO_DB = get_env('DJANGO_DB', DJANGO_DB_SQLITE)
|
||||
DATABASES = {'default': DATABASES_ALL[DJANGO_DB]}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ def main(request):
|
|||
|
||||
if user.active_organization is None and 'organization_pk' not in request.session:
|
||||
logout(request)
|
||||
return redirect(reverse('user-login'))
|
||||
return redirect(reverse('projects:project-index'))
|
||||
|
||||
# business mode access
|
||||
return redirect(reverse('projects:project-index'))
|
||||
|
||||
# not authenticated
|
||||
return redirect(reverse('user-login'))
|
||||
return redirect(reverse('projects:project-index'))
|
||||
|
||||
|
||||
def version_page(request):
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ def get_all_columns(project):
|
|||
'title': '已完成',
|
||||
'type': 'Datetime',
|
||||
'target': 'tasks',
|
||||
'help': '最后注释日期',
|
||||
'help': '最后标注日期',
|
||||
'visibility_defaults': {
|
||||
'explore': True,
|
||||
'labeling': False
|
||||
|
|
@ -92,10 +92,10 @@ def get_all_columns(project):
|
|||
},
|
||||
{
|
||||
'id': 'total_annotations',
|
||||
'title': '注释',
|
||||
'title': '标注',
|
||||
'type': "Number",
|
||||
'target': 'tasks',
|
||||
'help': '每个任务的总注释',
|
||||
'help': '每个任务的总标注',
|
||||
'visibility_defaults': {
|
||||
'explore': True,
|
||||
'labeling': True
|
||||
|
|
@ -106,7 +106,7 @@ def get_all_columns(project):
|
|||
'title': "已取消",
|
||||
'type': "Number",
|
||||
'target': 'tasks',
|
||||
'help': '完全取消(跳过)注释',
|
||||
'help': '完全取消(跳过)标注',
|
||||
'visibility_defaults': {
|
||||
'explore': True,
|
||||
'labeling': False
|
||||
|
|
@ -125,10 +125,10 @@ def get_all_columns(project):
|
|||
},
|
||||
{
|
||||
'id': 'annotations_results',
|
||||
'title': "注释结果",
|
||||
'title': "标注结果",
|
||||
'type': "String",
|
||||
'target': 'tasks',
|
||||
'help': '注释结果堆叠在所有注释上',
|
||||
'help': '标注结果堆叠在所有标注上',
|
||||
'visibility_defaults': {
|
||||
'explore': False,
|
||||
'labeling': False
|
||||
|
|
@ -180,7 +180,7 @@ def get_all_columns(project):
|
|||
},
|
||||
{
|
||||
'id': 'annotators',
|
||||
'title': '注释于',
|
||||
'title': '标注者',
|
||||
'type': 'List',
|
||||
'target': 'tasks',
|
||||
'help': '完成任务的所有用户',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from core.utils.common import find_editor_files
|
|||
from core.version import get_short_version
|
||||
|
||||
|
||||
@login_required
|
||||
# @login_required
|
||||
def task_page(request, pk):
|
||||
response = {
|
||||
'version': get_short_version()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ from django.shortcuts import render
|
|||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
|
||||
@login_required
|
||||
# @login_required
|
||||
def organization_people_list(request):
|
||||
return render(request, 'organizations/people_list.html')
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@ from organizations.models import Organization
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@login_required
|
||||
# @login_required
|
||||
def project_list(request):
|
||||
return render(request, 'projects/list.html')
|
||||
|
||||
|
||||
@login_required
|
||||
# @login_required
|
||||
def project_settings(request, pk, sub_path):
|
||||
return render(request, 'projects/settings.html')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue