frappe-core-permissions

Implement Frappe permission checks with has_permission hooks and frappe.get_list.

163|53|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-core-permissions-impertio-studio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frappe-core-permissions
Source: https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package/tree/main/skills/source/core/frappe-core-permissions
Command: npx skills add https://github.com/Impertio-Studio/Frappe_Claude_Skill_Package --skill frappe-core-permissions-impertio-studio

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill prevents Frappe/ERPNext permission bugs that look correct but fail in production, helping you reliably control who can access what, and which fields they can see or mask.

Core Features & Use Cases

  • Permission decisioning across layers: Applies the Frappe permission model end-to-end (role permissions, user permissions, perm levels, permission hooks, and v16+ data masking).
  • Production-safe APIs & patterns: Standardizes how to check permissions with frappe.has_permission(), document methods, and permission-aware listing via frappe.get_list() instead of permission-bypassing get_all().
  • Row-level and custom deny logic: Uses has_permission and permission_query_conditions hooks correctly for safe denial-only behavior and consistent row filtering.
  • Security guardrails: Covers critical anti-patterns like SQL injection in query hooks, missing table prefixes, returning True from has_permission hooks, and undocumented ignore_permissions.

Quick Start

Implement permission checks by asking an AI: "Use the frappe-core-permissions Skill to generate a secure has_permission hook for Sales Order write access, plus a permission_query_conditions hook for list filtering, ensuring all SQL inputs are escaped, the hook returns None by default, and user-facing queries use frappe.get_list()."

Frequently Asked Questions about frappe-core-permissions

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

FAQPage Schema
How do I implement row-level filtering in Frappe without bypassing permission checks?

To implement row-level filtering in Frappe without bypassing permissions, use frappe.get_list() for user-facing queries instead of frappe.get_all(), and apply permission_query_conditions hooks to filter list-view rows safely.

Why does my Frappe has_permission hook break standard role permissions?

Your Frappe has_permission hook breaks standard role permissions because it returns True, overriding standard evaluation. Hooks should only return False to deny access or return None to defer to standard Frappe permission checks.

How do I prevent SQL injection in Frappe permission_query_conditions hooks?

To prevent SQL injection in Frappe permission_query_conditions hooks, escape all SQL inputs and use proper table prefixes. This ensures that dynamic row-level filtering conditions are securely applied without exposing database vulnerabilities.

Does Frappe v16 support data masking for field-level access control?

Yes, Frappe v16 supports data masking for field-level access control. This Skill applies deterministic patterns across role permissions, user permissions, and perm levels to securely control which fields users can see or mask.

What is the best way to check document permissions in ERPNext custom scripts?

The best way to check document permissions in ERPNext custom scripts is using frappe.has_permission and document permission checks. This enforces backend access control and prevents permission-bypassing operations via ignore_permissions.

When should I avoid using ignore_permissions in Frappe document operations?

You should avoid using ignore_permissions in Frappe document operations whenever user-facing data is involved. Undocumented ignore_permissions bypasses standard access control, leading to insecure permission implementations that fail in production.