plutonium-policy

Define ActionPolicy methods controlling resource access with scoping and permissions.

68|10|Updated Jan 10, 2024
One-click install
npx skills add https://github.com/radioactive-labs/plutonium-core --skill plutonium-policy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: plutonium-policy
Source: https://github.com/radioactive-labs/plutonium-core/tree/main/.claude/skills/plutonium-policy
Command: npx skills add https://github.com/radioactive-labs/plutonium-core --skill plutonium-policy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Policies control WHO can do WHAT with resources. Built on ActionPolicy.

Core Features & Use Cases

  • Attribute permissions (permitted_attributes_for_read, permitted_attributes_for_create) to control which fields can be read or set.
  • Association permissions (permitted_associations) to restrain related data rendering and nested forms.
  • Automatic entity scoping for multi-tenancy to enforce per-entity access.
  • Derived action methods (e.g., update? inherits from create?) to share authorization logic.
  • Bulk action authorization with per-record checks and intersection-based UI tightening.
  • Comprehensive collection and nested-resource scoping via relation_scope, default_relation_scope, and skip/default mechanics.

Quick Start

Instantiate a policy class (e.g., PostPolicy) extending ResourcePolicy and override core methods like create? and read? while configuring relation_scope for multi-tenancy.

Frequently Asked Questions about plutonium-policy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define multi-tenant authorization policies in Rails?

Multi-tenant authorization policies in Rails are defined by extending ResourcePolicy, overriding core methods like create? and read?, and applying relation_scope to enforce per-entity access control. Derived actions inherit logic to share authorization rules.

How do I restrict attribute permissions for create and read actions?

Attribute permissions for create and read actions are restricted using permitted_attributes_for_create and permitted_attributes_for_read methods, controlling exactly which fields users can set or view within the resource policy.

What is the best way to authorize bulk actions with per-record checks?

Bulk action authorization with per-record checks is handled natively by running intersection-based validations across the collection, tightening UI visibility and ensuring only authorized records process successfully.

How does relation_scope work for nested resource scoping?

Relation_scope for nested resource scoping works by applying default_relation_scope and parent/entity scoping mechanics, automatically filtering collection access to enforce multi-tenancy boundaries across related models.

Can I control association rendering and nested forms using ActionPolicy?

ActionPolicy controls association rendering and nested forms by defining permitted_associations within the policy class, restraining related data exposure and securing nested form inputs based on user authorization.

Do I need to explicitly override create? and read? methods?

Explicit overrides for create? and read? methods are required to establish baseline authorization, while derived action methods like update? automatically inherit from create? to share logic without duplication.