dify/api/controllers/console/workspace/plugin.py

26 lines
835 B
Python
Raw Normal View History

2024-09-20 15:08:39 +08:00
from flask_login import current_user
from flask_restful import Resource
from werkzeug.exceptions import Forbidden
from controllers.console import api
from controllers.console.setup import setup_required
from controllers.console.wraps import account_initialization_required
from libs.login import login_required
from services.plugin.plugin_debugging_service import PluginDebuggingService
class PluginDebuggingKeyApi(Resource):
@setup_required
@login_required
@account_initialization_required
def get(self):
user = current_user
if not user.is_admin_or_owner:
raise Forbidden()
2024-09-20 15:08:39 +08:00
tenant_id = user.current_tenant_id
return {"key": PluginDebuggingService.get_plugin_debugging_key(tenant_id)}
2024-09-20 15:08:39 +08:00
api.add_resource(PluginDebuggingKeyApi, "/workspaces/current/plugin/debugging-key")