Permissions Rbacのロゴ

Permissions Rbac

組織
vstorm-co
permissions-rbac

Gate a route or a service on who may do it — add a permission, wire a role, decide between require() and resolve_access, share a resource with a grant, or debug "this user can see something they should not" and "a Viewer with an edit grant is being refused". Use for any authorization work, any new org-scoped route, and any review of one. There is no UserRole, RoleChecker or CurrentAdmin in this project.

概要

公開者vstorm-co
リポジトリagenticos
スキル名permissions-rbac
スター
137
フォーク
27
同梱ファイル
1
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 1個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    vstorm-coがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Permissions Rbac」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/vstorm-co/agenticos/tree/main/.claude/skills/permissions-rbac
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/vstorm-co/agenticos.git /tmp/agenticos
mkdir -p .claude/skills
cp -r /tmp/agenticos/.claude/skills/permissions-rbac .claude/skills/permissions-rbac
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでPermissions Rbacを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にPermissions Rbacを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Permissions Rbacは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Permissions — three layers, and one rule people get wrong

Read docs/permissions.md for the model and docs/reference/permissions.md for the generated catalog. .claude/rules/exceptions-security.md has the code shapes. This file is what to do and what not to.

Permissions are defined in code; roles are composed from them. Call sites check permissions, never role names, so adding or re-shaping a role never means editing an endpoint.

The rule that gets broken

require(...) gates belong on collection routes, not per-resource ones.

Route shapeGate
GET /agents, POST /agents, GET /agents/capabilitiesdependencies=[Depends(require(Perm.AGENTS_EDIT))]
GET/PATCH/DELETE /agents/{id}, POST /agents/{id}/publishNo route gate. The service calls resolve_access

A role gate cannot see the grants on a row. Put one on a per-resource route and it refuses a Viewer holding an explicit edit grant before resolve_access ever widens their access — which directly contradicts the platform's own promise that a grant widens what a role allows and never narrows it.

tests/api/test_platform_routes.py enforces both halves. If it fails after you added a gate, the gate is the bug.

The two calls

python
# Collection route — a permission, as a route dependency.
@router.post("", dependencies=[Depends(require(Perm.AGENTS_EDIT))])
async def create_agent(ctx: Auth, service: AgentSvc) -> Any: ...

# One row — in the service, never as a route gate.
if not await resolve_access(self.db, ctx, agent, Perm.AGENTS_EDIT, resource_type=AGENT):
    raise AuthorizationError(message="...")

Listings need the third call, or shared rows silently vanish:

python
extra = await visible_resource_ids(db, ctx, resource_type=AGENT, perm=Perm.AGENTS_VIEW)
# None means the role already reaches everything — skip the grant lookup.
# An empty list is NOT the same as None; a context with no subject gets [].

The three layers

  1. users.is_app_admin — the deployment superadmin. CurrentAppAdmin. uv run agenticos cmd create-app-admin <email> [--revoke].
  2. The organization role — owner, admin, builder, operator, member, viewer. Composed from permissions in app/core/permissions.py.
  3. Visibility and grants — a grant on one row, to a person or to a group (docs/directory.md#groups). effective = max(role scope, grant on this resource).

Capability scopes (knowledge:read, web:read, code:execute) are a separate axis, not a fourth layer: they are what an organization allows its agents to do, checked when an agent is assembled rather than per request. See the agent-capability skill.

Resource permissions carry a Scope: none, own, shared, all. It answers the question a role cannot — not "may this role touch agents?" but which agents.

What does not exist

UserRole, User.has_role(), RoleChecker, CurrentAdmin, CurrentSuperuser. The users.role column was dropped before the migration chain was squashed, so there is no revision to point at: 0001_baseline simply creates users without it. Do not reintroduce any of them, and do not add --role to a CLI command. Authority inside an organization is a membership row plus this catalog.

Only two user aliases exist: CurrentUser and CurrentAppAdmin. Anything org-scoped goes through Auth (AuthContext) plus a permission.

Adding a permission

  1. Add to Perm in app/core/permissions.py.
  2. Add it to every role in the matrix that should have it — with a Scope if it is a resource permission.
  3. Gate the collection routes; hand per-resource decisions to a service.
  4. Test the refusal, and test it cross-tenant. Most of this platform's value is in what it refuses.
  5. The frontend reads the effective permission set — check what it hides, and add an integration test that a button is actually gone (see the frontend-feature and e2e-tests skills).

Always test

  • Tenant isolation — unreachable from another organization including when the caller owns the row.
  • A grant widening, not promoting — a Viewer with an edit grant on one agent edits that agent and nothing else.
  • A context with no subject — API key, embed session, channel run. See docs/permissions.md#contexts-with-no-subject.

Depth

references/catalog.md — the permission list, the role matrix, and how resolve_access decides.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Permissions Rbac」では何ができますか?

Gate a route or a service on who may do it — add a permission, wire a role, decide between require() and resolve_access, share a resource with a grant, or debug "this user can see something they should not" and "a Viewer with an edit grant is being refused". Use for any authorization work, any new org-scoped route, and any review of one. There is no UserRole, RoleChecker or CurrentAdmin in this project.

TypingMindでPermissions Rbacを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Permissions Rbacはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにPermissions Rbacをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/vstorm-co/agenticos/tree/main/.claude/skills/permissions-rbacを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Permissions Rbacを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Permissions Rbacで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもPermissions Rbacを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Permissions Rbac」は無料ですか?

はい。vstorm-coがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇