Skip to content

Commit

Permalink
minor: disable web browsable api --story=119850967
Browse files Browse the repository at this point in the history
  • Loading branch information
benero committed Oct 3, 2024
1 parent 442b34a commit 9d77c88
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ def _(s):
"rest_framework.parsers.FormParser",
"rest_framework.parsers.MultiPartParser",
),
"DEFAULT_RENDERER_CLASSES": ("rest_framework.renderers.JSONRenderer",)
}

# ==============================================================================
Expand Down
5 changes: 0 additions & 5 deletions config/prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@
# CORS_ORIGIN_WHITELIST = CSRF_WHITELIST
CORS_ORIGIN_ALLOW_ALL = True

# disable web browsable api in production
# http://masnun.com/2016/04/20/django-rest-framework-remember-to-disable-web-browsable-api-in-production.html
REST_FRAMEWORK.update(
{"DEFAULT_RENDERER_CLASSES": ("rest_framework.renderers.JSONRenderer",)}
)

MEDIA_URL = "%smedia/" % SITE_URL
CSRF_COOKIE_NAME = os.environ.get("BKAPP_CSRF_COOKIE_NAME", "bkitsm_csrftoken")
Expand Down
3 changes: 2 additions & 1 deletion iam/contrib/django/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"""

from django.http.response import JsonResponse
from django.utils.translation import ugettext as _

from iam.contrib.http import HTTP_AUTH_FORBIDDEN_CODE

Expand All @@ -21,7 +22,7 @@ def __init__(self, exc, *args, **kwargs):
kwargs["data"] = {
"result": False,
"code": HTTP_AUTH_FORBIDDEN_CODE,
"message": "you have no permission to operate",
"message": _("您没有此操作的权限"),
"data": None,
"permission": exc.perms_apply_data(),
}
Expand Down
3 changes: 3 additions & 0 deletions itsm/component/constants/iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,9 @@
"ticket_state_view",
"ticket_state_manage",
"platform_manage_access",
"public_fields_manage",
"public_apis_manage",
"public_task_template_manage",
]

IAM_SEARCH_INSTANCE_CACHE_TIME = 10 * 60 # 缓存5分钟

0 comments on commit 9d77c88

Please sign in to comment.