Agent skill
security-privileges
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.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/security-privileges
SKILL.md
Privilege System Reference
Core Principles
- Declare privileges in
Privileges.java- append to enum without reordering - Check in controllers via
webUserController.hasPrivilege(...) - Assign through UI via User Privileges admin interface; never seed in database
- Name descriptively so usage is obvious from enum value
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
- Check
src/main/java/com/divudi/core/data/Privileges.java- reuse existing if matching behavior exists - Never rename or edit legacy enum values (backward compatibility)
- Add to most relevant section, keeping existing grouping
- Update
src/main/webapp/admin/users/user_privileges.xhtmlfor UI assignment - Extend
UserPrivilageController.createPrivilegeHolderTreeNodes()for tree rendering
Usage in XHTML
<p:column rendered="#{webUserController.hasPrivilege('PharmacyTransferViewRates')}">
<h:outputText value="#{item.rate}" />
</p:column>
Testing Checklist
- Log in WITHOUT the privilege - confirm UI element is hidden/disabled
- Log in WITH the privilege - verify workflow succeeds end-to-end
- Document new privilege in release notes
For complete reference, read developer_docs/security/privilege-system.md.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?