- classes.FrontendPermissionCatalog: the seeded rows, then codes activated plugins declare through pact.HasFrontendPermissions (seeded row wins); both permission editors offer it - classes.MCPUserGuard (guard "user"): reads user.api_token, user.scope:* and user.permission:*, allows with the route's checks (session scopes, group grants, every code), dispatches with an in-memory token credential, resolves usr_ personal tokens; registered in *pact.MCPGuards and published as pact.MCPPersonalTokenResolver - GET /_user/api/v1/token/me (user.api_token, user.scope:read) and the MCP tool me (user_me) - pact.MCPSubjectChanged on token revoke, Users saves and User Groups saves and deletes
25 lines
644 B
Go
25 lines
644 B
Go
package user
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"git.golem15.com/golem15/summercms/modules/pact"
|
|
)
|
|
|
|
var _ pact.HasMCP = (*Plugin)(nil)
|
|
|
|
// MCP declares the plugin's MCP tools (D-18). me (exposed as user_me) runs
|
|
// GET /_user/api/v1/token/me as the signed-in frontend user under the
|
|
// "user" guard and answers the user payload.
|
|
func (p *Plugin) MCP() pact.MCP {
|
|
return pact.MCP{Tools: []pact.MCPTool{{
|
|
Name: "me",
|
|
Title: "Current user",
|
|
Description: "Returns the profile of the signed-in frontend user.",
|
|
Guard: "user",
|
|
Method: http.MethodGet,
|
|
Path: "/_user/api/v1/token/me",
|
|
Input: struct{}{},
|
|
}}}
|
|
}
|