mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-20 05:30:30 +00:00
✨ Add Super-Admin tools for managing any model
- 🛠️ Introduced generic Super-Admin MCP tools, including `list-models`, `describe-model`, `list-records`, `show-record`, `create-record`, and `update-record`. - 🛡️ Restricted modification of critical fields (e.g., passwords, roles, tokens) to enhance security. - ✅ Added extensive feature tests for Super-Admin functionality and access control. - 📜 Increased pagination length to accommodate new tools on a single page. - 🔗 Registered Super-Admin tools in `EinundzwanzigServer`.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mcp\Tools\SuperAdmin;
|
||||
|
||||
use App\Mcp\Support\SuperAdminModels;
|
||||
use App\Mcp\Tools\SuperAdmin\Concerns\AuthorizesSuperAdmin;
|
||||
use Laravel\Mcp\Request;
|
||||
use Laravel\Mcp\Response;
|
||||
use Laravel\Mcp\Server\Attributes\Description;
|
||||
use Laravel\Mcp\Server\Tool;
|
||||
use Laravel\Mcp\Server\Tools\Annotations\IsReadOnly;
|
||||
|
||||
#[IsReadOnly]
|
||||
#[Description('NUR SUPER-ADMIN: Listet alle bearbeitbaren Models (key, Klasse, Tabelle). Ausgangspunkt, um anschließend per super-admin-describe-model die Felder zu sehen und Datensätze zu bearbeiten.')]
|
||||
class SuperAdminListModelsTool extends Tool
|
||||
{
|
||||
use AuthorizesSuperAdmin;
|
||||
|
||||
public function handle(Request $request): Response
|
||||
{
|
||||
if ($denied = $this->denyUnlessSuperAdmin($request)) {
|
||||
return $denied;
|
||||
}
|
||||
|
||||
return Response::json(SuperAdminModels::list());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user