Extract authn & authz utils
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -13,14 +13,14 @@ import (
|
||||
"go.probo.inc/probo/pkg/mail"
|
||||
"go.probo.inc/probo/pkg/page"
|
||||
"go.probo.inc/probo/pkg/probo"
|
||||
connect_v1 "go.probo.inc/probo/pkg/server/api/connect/v1"
|
||||
"go.probo.inc/probo/pkg/server/api/authn"
|
||||
"go.probo.inc/probo/pkg/server/api/mcp/v1/types"
|
||||
)
|
||||
|
||||
// ListOrganizationsTool handles the listOrganizations tool
|
||||
// List all organizations the user has access to
|
||||
func (r *Resolver) ListOrganizationsTool(ctx context.Context, req *mcp.CallToolRequest, input *types.ListOrganizationsInput) (*mcp.CallToolResult, types.ListOrganizationsOutput, error) {
|
||||
user := connect_v1.IdentityFromContext(ctx)
|
||||
user := authn.IdentityFromContext(ctx)
|
||||
|
||||
organizations, err := r.iamSvc.AccountService.ListOrganizations(ctx, user.ID)
|
||||
if err != nil {
|
||||
@@ -1686,7 +1686,7 @@ func (r *Resolver) PublishDocumentVersionTool(ctx context.Context, req *mcp.Call
|
||||
|
||||
svc := r.ProboService(ctx, input.DocumentID)
|
||||
|
||||
user := connect_v1.IdentityFromContext(ctx)
|
||||
user := authn.IdentityFromContext(ctx)
|
||||
|
||||
document, documentVersion, err := svc.Documents.PublishVersion(ctx, input.DocumentID, user.ID, input.Changelog)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user