Frappe HR REST Access Starts With Role and User Permissions
Frappe HR REST Access Starts With Role and User Permissions
Frappe HR stores employee records, attendance, leave, payroll inputs, performance notes and exit information. It runs on the Frappe framework, which automatically exposes every DocType and whitelisted Python function over a JSON REST API. The web interface and the API are two views of the same permission model. A hidden button does not protect a DocType, and a disabled form does not block a direct HTTP request.
Frappe's permission model combines roles, permission levels and user permissions. Role permissions control which actions a role can perform on a DocType. User permissions can restrict a role to a company or another linked record. Permission levels can separate fields within a document. The official Frappe HR guidance says to keep Create User Permission enabled for employees so a user sees only their own employee record and company.
Build a direct access test
Create test users for an HR manager, an HR user, a line manager and an employee. Record the DocTypes and actions each role needs. Then call the REST API directly with each account. Test list, read, create, update, delete and report endpoints. Include linked documents and file attachments because permission on an Employee record does not automatically justify access to payroll, bank details or private notes.
Use frappe.has_permission and server-side role checks for custom endpoints. Client-side visibility is useful for the interface; it is not an authorization control. Any whitelisted method should validate the requested company, employee and record type before performing a write. Bulk methods deserve particular attention because one request can touch many records.
Control API identity
Frappe REST supports authentication through the framework's API mechanisms. Treat an API key or token as a user credential with that user's role and user-permission scope. Create service accounts for integrations, keep them out of browser code and rotate them on a documented schedule. On offboarding, disable the user and revoke keys and sessions rather than relying on a password change alone.
Restrict the site to trusted networks where possible. Put the desk and API behind a reverse proxy, require TLS and add request-rate limits for authentication and report endpoints. Search logs for API requests from unexpected IP addresses, unusual user-agent strings and large export or report jobs. Do not log full authorization headers.
Review custom code
Custom Frappe apps often add exactly the fields that matter most: payroll adjustments, disciplinary notes or medical documentation. Review those DocTypes and their role permissions after every migration. Check server scripts, scheduled jobs and webhooks for bypassed permissions or hard-coded administrator context. A background job may legitimately run as Administrator, but it must not accept unvalidated user input that changes its target.
Permission levels need a clear definition. If a field is hidden from an HR user at level 0, test whether a CSV export, print format or report leaks it. Users can sometimes reach the same data through a linked DocType, so testing only the main form leaves a gap.
Operate the permission model
Run a quarterly access review. Compare active employees with site users, roles, company permissions and API keys. Remove roles that are no longer required and document any temporary elevation. Monitor changes to role permissions and custom scripts. Keep Frappe, Frappe HR and third-party apps patched; a framework package update does not cover every custom app.
After a change, repeat the negative tests. An employee should not read another employee's record, an HR user should not change the permission model, and an integration should not access a company outside its granted scope. Keep the test accounts in a controlled environment and remove them or disable them after use.