The Permission Matrix
HardAcc. 81.4%
+40 XP 20
Vault Access
Security is all about multiple checks. In this mission, you are building the permission gate for a high-security server.
The Rules
- Admins: Can edit any file UNLESS the file is strictly locked (
isLocked = true). - Users: Can edit a file only if BOTH are true:
- They are the owner (
isOwner = true). - The file is NOT locked (
isLocked = false).
- They are the owner (
- Anyone else: Forbidden.
Your Task
Receive three parameters: role (string: 'admin' or 'user'), isOwner (boolean), and isLocked (boolean).
Return "Granted" if they can edit, otherwise return "Denied".
01EXAMPLE 1
Input
role='admin', isOwner=false, isLocked=falseOutput
"Granted"Explanation: Admins have global access.
02EXAMPLE 2
Input
role='user', isOwner=true, isLocked=trueOutput
"Denied"Explanation: Users cannot bypass a lock, even as owners.
Constraints
- Role will either be "admin" or "user".
- Return "Granted" or "Denied" exactly.
Control FlowSecurityLogic
JavaScriptSystem handles I/O — write your function only
Loading...
4 Hidden
Input Arguments
role"admin"
isOwnerfalse
isLockedfalse
Expected Output
Granted
Click RUN to test your solution