auth-usage

Enforce API-level and field-level permissions with Casbin in Genies services.

1|Updated Mar 16, 2024
One-click install
npx skills add https://github.com/tdcare/genies --skill auth-usage
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth-usage
Source: https://github.com/tdcare/genies/tree/main/.qoder/skills/auth-usage
Command: npx skills add https://github.com/tdcare/genies --skill auth-usage

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a guided approach to implementing and understanding API-level access control and field-level permission filtering using the genies_auth Casbin-based module across Genies services.

Core Features & Use Cases

  • Comprehensive RBAC with Casbin for API-level and field-level permissions
  • Dynamic policy management and OpenAPI schema synchronization
  • EnforcerManager orchestration and casbin_auth middleware integration
  • Admin API surface for policies, roles, groups, and model configuration

Quick Start

Initialize the auth module, mount casbin_auth on your Salvo router, and run migrations.

Frequently Asked Questions about auth-usage

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

FAQPage Schema
How do I enforce RBAC permissions for API endpoints using Casbin?

You can enforce API-level RBAC permissions by mounting the casbin_auth middleware on your router and using the EnforcerManager to orchestrate policy checks for incoming requests.

Can I filter nested data structures with field-level permissions in Casbin?

Yes, field-level permissions support filtering nested and complex data structures, allowing you to mask or restrict specific fields in API responses based on dynamic authorization policies.

How do I synchronize Casbin policies with an OpenAPI schema?

Casbin policy synchronization with OpenAPI is handled by extracting endpoint schemas directly from your OpenAPI definitions, ensuring your authorization rules automatically match your API surface.

What is the best way to manage dynamic authorization policies for a web service?

Managing dynamic authorization policies is done through the admin API surface, which handles roles, groups, model configurations, and multi-instance version synchronization without requiring application restarts.

Does Casbin middleware work with the Salvo router for access control?

Yes, the casbin_auth middleware integrates directly with the Salvo router, allowing you to mount authorization checks and run necessary database migrations during module initialization.

How does the EnforcerManager orchestrate multi-instance Casbin authorization?

The EnforcerManager orchestrates multiple Casbin enforcers across service instances, handling dynamic policy updates and multi-instance version synchronization to maintain consistent access control rules.