feat: add 'agent' API key role (content CRUD + backup)
- ALLOWED_API_KEY_ROLES (+ apikey_cli ALLOWED_ROLES) gain 'agent'. - 'agent' added to require_auth on markdown/patch/path create/update/ delete/move and backup get/load. apikey mint, /backup/convert, logs, config, webhook and permission/template settings stay admin-only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
12
api/path.py
12
api/path.py
@@ -82,7 +82,7 @@ def get_path_by_parent(parent_id):
|
||||
|
||||
@path_bp.route('/', methods=['POST'])
|
||||
@limiter.limit(api.get_rate_limit)
|
||||
@require_auth(roles=['admin', 'creator'])
|
||||
@require_auth(roles=['admin', 'creator', 'agent'])
|
||||
def create_path():
|
||||
"""
|
||||
Create a new path.
|
||||
@@ -119,7 +119,7 @@ def create_path():
|
||||
|
||||
@path_bp.route('/<int:path_id>', methods=['PUT'])
|
||||
@limiter.limit(api.get_rate_limit)
|
||||
@require_auth(roles=['admin'])
|
||||
@require_auth(roles=['admin', 'agent'])
|
||||
def update_path(path_id):
|
||||
"""
|
||||
Update a path.
|
||||
@@ -158,7 +158,7 @@ def update_path(path_id):
|
||||
|
||||
@path_bp.route('/<int:path_id>', methods=['PATCH'])
|
||||
@limiter.limit(api.get_rate_limit)
|
||||
@require_auth(roles=['admin'])
|
||||
@require_auth(roles=['admin', 'agent'])
|
||||
def patch_path(path_id):
|
||||
"""
|
||||
Partially update a path.
|
||||
@@ -205,7 +205,7 @@ def patch_path(path_id):
|
||||
|
||||
@path_bp.route('/<int:path_id>', methods=['DELETE'])
|
||||
@limiter.limit(api.get_rate_limit)
|
||||
@require_auth(roles=['admin'])
|
||||
@require_auth(roles=['admin', 'agent'])
|
||||
def delete_path(path_id):
|
||||
"""
|
||||
Delete a path.
|
||||
@@ -240,7 +240,7 @@ def delete_path(path_id):
|
||||
|
||||
|
||||
@path_bp.route('/move_forward/<int:path_id>', methods=['PATCH'])
|
||||
@require_auth(roles=['admin'])
|
||||
@require_auth(roles=['admin', 'agent'])
|
||||
@limiter.limit(api.get_rate_limit)
|
||||
def move_forward(path_id):
|
||||
"""
|
||||
@@ -277,7 +277,7 @@ def move_forward(path_id):
|
||||
|
||||
|
||||
@path_bp.route('/move_backward/<int:path_id>', methods=['PATCH'])
|
||||
@require_auth(roles=['admin'])
|
||||
@require_auth(roles=['admin', 'agent'])
|
||||
@limiter.limit(api.get_rate_limit)
|
||||
def move_backward(path_id):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user