PermissionMap
Rasuvaeff\Yii3McpRbacBridge\PermissionMap
Class — Rasuvaeff\Yii3McpRbacBridge — Source
tool name → required RBAC permission. Tools absent from the map are unrestricted (no permission needed) — restriction is an explicit, per-tool decision.
Built from an explicit array, from #[RequiredPermission] attributes on the same tool classes the server registers, or both (explicit entries override attribute-derived ones).
Methods
fromToolClasses()
static fromToolClasses(array $toolClasses, array $overrides): selfScans the tool classes for #[McpTool] methods carrying #[RequiredPermission] — the same classes listed in the yii3-mcp tools params.
One tool name mapped to two different permissions by attributes is a configuration bug and throws — the last-one-wins silent overwrite would enforce an arbitrary permission. Explicit $overrides win by design and are exempt.
permissionFor()
permissionFor(string $toolName): ?string