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

  1. Admins: Can edit any file UNLESS the file is strictly locked (isLocked = true).
  2. Users: Can edit a file only if BOTH are true:
    • They are the owner (isOwner = true).
    • The file is NOT locked (isLocked = false).
  3. 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

Inputrole='admin', isOwner=false, isLocked=false
Output"Granted"

Explanation: Admins have global access.

02EXAMPLE 2

Inputrole='user', isOwner=true, isLocked=true
Output"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
JavaScript
Loading...
4 Hidden

Input Arguments

role"admin"
isOwnerfalse
isLockedfalse

Expected Output

Granted

Click RUN to test your solution