Sigma Computing - Software Engineer, Frontend/Data Visualization - Technical Screen
Description Template:
Level: L4
Years of Experience: 3
Questions Asked:
/*
We have a collection of documents arranged into folders. We’d like to implement a basic permission system for the documents.
Permissions should be inherited: if a user has access to a folder, they should have access to everything in that folder as well, including subfolders.
We want the following functions:
- grantPermission(item, user) // Gives
user
permission to accessitem
- hasPermission(item, user) // Returns whether
user
has access toitem
item
in this case can be either a folder or a regular document. Argument types can be defined however you wish.
We want to make our product a little more security conscious by adding in different levels of permission. For this assume that we have three levels available:
- Can administer
- Can edit
- Can view
We want a new function to see the user’s permission level:
- getPermission(item, user)
*/