Security privileges

From hmislk/hmis · View interactive version

Security privileges is an AI agent skill from the GitHub repository hmislk/hmis. Privilege system reference for the HMIS project. Use when adding new privileges, implementing access control, working with user roles, checking privilege-based rendering in XHTML, or auditing security controls.

How to use this skill

Skill file

Privilege System Reference

Core Principles

Common Privileges

| Privilege | Description |

|-----------|-------------|

| StockTransactionViewRates | Rate/value fields in stock transactions |

| PharmacyTransferViewRates | Rates in pharmacy transfer reports |

| Developers | All bill formats for dev/QA validation |

Adding a New Privilege

  1. Check src/main/java/com/divudi/core/data/Privileges.java - reuse existing if matching behavior exists
  2. Never rename or edit legacy enum values (backward compatibility)
  3. Add to most relevant section, keeping existing grouping
  4. Update src/main/webapp/admin/users/user_privileges.xhtml for UI assignment
  5. Extend UserPrivilageController.createPrivilegeHolderTreeNodes() for tree rendering

Usage in XHTML

<p:column rendered="#{webUserController.hasPrivilege('PharmacyTransferViewRates')}">
    <h:outputText value="#{item.rate}" />
</p:column>

Testing Checklist

For complete reference, read developer_docs/security/privilege-system.md.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.