Gli agenti autenticati con token Bearer possono leggere today/pipeline e annotare attività, con host MCP allineati a quelli di produzione. Co-authored-by: Cursor <cursoragent@cursor.com>
27 lines
724 B
Ruby
27 lines
724 B
Ruby
class ApiTokensController < ApplicationController
|
|
before_action :set_api_token, only: :destroy
|
|
|
|
def index
|
|
@page_title = "Token API"
|
|
@api_tokens = current_user.api_tokens.active.order(created_at: :desc)
|
|
@revealed_token = session.delete(:revealed_api_token)
|
|
end
|
|
|
|
def create
|
|
token = ApiToken.issue!(user: current_user, name: params[:name])
|
|
session[:revealed_api_token] = token.plaintext
|
|
redirect_to api_tokens_path, notice: "Token creato. Copialo ora: non sarà più visibile."
|
|
end
|
|
|
|
def destroy
|
|
@api_token.revoke!
|
|
redirect_to api_tokens_path, notice: "Token revocato."
|
|
end
|
|
|
|
private
|
|
|
|
def set_api_token
|
|
@api_token = current_user.api_tokens.active.find(params[:id])
|
|
end
|
|
end
|