Apps & Software
Role-Based Login and Activity Logs: Security Features for Internal Applications
Role-based login decides who may view and change what, while an activity log records who did what and when. This guide covers how to design both in an internal application and how to check them before handover.
SEO and Content Specialist
6 min read
Short answer: role-based access control (RBAC) in an application means access rights are given to roles (for example staff, approver, admin), and each user is then given one or more roles. An activity log complements it with a record of who did what, when, and from where. Both only work if the roles are defined in the requirements document, every request is checked on the server with a deny-by-default principle, and the log cannot be changed by the users it records.
Internal applications are usually born from spreadsheets or emails that can no longer cope. Once moved into an application, questions that were never answered before must be answered: who may see salary data, who may approve a request, and how to trace a change nobody admits to. Role-based access control in applications and activity logs are the two features that answer them. This guide covers how to design, test, and maintain both.
What is role-based access control in an application
Role-based access control is a model in which access rights are managed through roles rather than set one by one for each user. According to NIST, with RBAC security is managed at a level that corresponds closely to the organization’s structure: each user is assigned one or more roles, and each role is assigned one or more privileges. This NIST model was adopted as the ANSI/INCITS 359-2004 standard and revised as INCITS 359-2012.
For a company, the main benefit is easier administration. When an employee moves to another department, you only change their role. When a policy changes, for example approvers may now export reports, you change the rights of one role, not dozens of accounts. The RBAC standard also covers role hierarchies (roles that inherit the rights of other roles) and separation of duty, the rule that two particular roles may not be held by the same person, or may not be active together in one session.
Building a role matrix before the application is built
Roles are easiest and cheapest to decide on paper, not after the application is finished. A role matrix maps each role to each important action. An example for a procurement request application:
| Action | Requesting staff | Approver | Finance | Application admin |
|---|---|---|---|---|
| Create a request | Yes | No | No | No |
| View requests | Own only | Own unit | All | All |
| Approve a request | No | Own unit, not own requests | No | No |
| Record payment | No | No | Yes | No |
| Manage accounts and roles | No | No | No | Yes |
| Read the activity log | No | No | Limited | Yes |
This example is an illustration, not a fixed design. Note two things in it. First, many cells say “own only” or “own unit”: access often depends on the data, not just on the role. Second, an approver may not approve their own request, an example of separation of duty. A matrix like this should be part of the requirements document, as explained in How to Write a Requirements Document Before Building an Application.
Principles that prevent access leaks
Broken access control ranks first among web application security risks in the OWASP Top 10:2025 (A01, Broken Access Control). In the data OWASP collected for that edition, every application tested was found to have at least one form of access control weakness. The following principles from the OWASP Authorization Cheat Sheet and the A01 page are worth making requirements in a contract or requirements document:
- Least privilege. Each role only gets the access its work needs, and accumulated rights are reviewed periodically.
- Deny by default. The application always makes an explicit decision to allow; if no rule matches, access is denied.
- Checked on every request, on the server. Hiding a button in the interface is not enough. Checks in the browser are only for convenience; the final decision is made on the server.
- Data ownership is checked. Changing a document number in an address or request must not open another person’s data. This weakness is known as an insecure direct object reference.
- Tested automatically. Unit and integration tests confirm that access is denied according to the matrix, so later code changes do not quietly open a gap.
When roles alone are not enough
Pure RBAC fits when access rights are truly determined by job title. Problems arise when rules depend on the data: branch, region, transaction value, or document owner. If every such combination becomes a role, the number of roles balloons (“Surabaya Branch Approver below a certain limit”). The OWASP Authorization Cheat Sheet names this problem and recommends attribute-based (ABAC) or relationship-based (ReBAC) models for more detailed rules.
In practice, many internal applications use a combination: roles to decide the type of action, plus data rules such as “own unit” or “own only”. What needs to be ensured is that these rules are written in one place and checked with the same mechanism across the whole application, not rewritten on every page.
Activity logs: what to record and how to protect them
Access rights decide what may be done; the activity log records what was actually done. The OWASP Logging Cheat Sheet asks that each event record when, where, who, and what. Events that should always be logged include login successes and failures, authorization failures, and use of higher-risk functions such as user management, use of admin privileges, access to sensitive data, and file uploads. The A01 page also advises logging access control failures and alerting admins when they repeat.
The log itself needs protection:
- Data that must not go into the log: passwords, access tokens, session identifiers, encryption keys, and sensitive personal data, unless masked.
- Tamper resistance: category A09 of the OWASP Top 10:2025 (Security Logging and Alerting Failures) recommends tamper-resistant audit trails, for example append-only tables, and log backups that are not only stored on the same server.
- Limited read access: the right to read logs is given to specific roles and reviewed periodically, because logs often contain sensitive information.
A shorter explanation of activity logs and their everyday use is in What Is an Activity Log.
Checklist before the application is handed over
- The approved role matrix is available and matches how the application behaves.
- Test accounts for each role have been tried: forbidden actions are really denied, including through modified addresses or requests.
- Separation of duty works: whoever creates a request cannot approve it themselves.
- Failed logins, denied access, and role changes appear in the activity log with the user and time.
- There are no passwords or tokens in the log.
- The application admin cannot delete or edit activity log records.
- The procedure for removing roles when an employee moves or leaves has been set on the company’s side.
A shared spreadsheet can hardly meet this list, one of the signs covered in Signs Your Business Process Has Outgrown the Spreadsheet.
How Legia does it
In the Web Application Development service, security is part of the design: role-based login so each user only sees and changes what they are entitled to, an activity log that records who changed what and when, automatic backups, and security checks on the system. The scope of the checks and the backup schedule are agreed during the requirements mapping stage. The number of user roles and their rules is also part of the cost basis, so the role matrix is best discussed from the start. Other services in this pillar are on the Applications & Software page.
Frequently asked questions
Who should grant and remove user roles?
The process owner in the company decides who gets which role, while the application admin carries it out. This separation prevents a technical admin from granting themselves access to business data without the process owner knowing.
May one user hold several roles?
Yes, and the RBAC standard allows it. What needs guarding is conflicting combinations, for example creator and approver on the same request. Combinations like that are written as separation of duty rules.
Can role-based login be added to an application that is already running?
Yes, but it is usually more expensive than doing it from the start, because access checks must be added to every existing part and retested. Start with the most sensitive data and actions.
Sources
- NIST, Role Based Access Control (RBAC) projectcsrc.nist.gov
- NIST, RBAC Frequently Asked Questionscsrc.nist.gov
- OWASP Top 10:2025, A01 Broken Access Controltop10.owasp.org
- OWASP Top 10:2025, A09 Security Logging and Alerting Failurestop10.owasp.org
- OWASP Authorization Cheat Sheetcheatsheetseries.owasp.org
- OWASP Logging Cheat Sheetcheatsheetseries.owasp.org


