Start by clarifying requirements (scale, consistency, latency) and then design a data model that represents files, folders, users, groups, and permissions. Explain how inheritance works and how you would efficiently check access, considering caching and denormalization for performance. Finally, discuss trade-offs between simplicity and scalability.
Pro tip: Mention that you would use a materialized path or closure table for folder hierarchy to enable efficient inheritance checks, and consider caching effective permissions per user-file pair to avoid recursive lookups at scale.
Ask about scale (number of users, files, groups), consistency needs, latency requirements, and whether permissions can be changed frequently. This sets the stage for design decisions.
Define entities: User, Group, File, Folder, Permission. Decide on relationships: users belong to groups, permissions can be assigned to users or groups on files/folders. Consider using a unified 'Node' table for files and folders to simplify inheritance.
Explain how permissions inherit down the folder hierarchy. Discuss approaches: recursive queries, materialized paths, or closure tables. Describe how to compute effective permissions (union of user and group permissions, with deny overrides if needed).
Address how to avoid expensive recursive checks: caching effective permissions, precomputing access control lists (ACLs), or using a permission service with in-memory caches. Discuss consistency trade-offs.
Compare SQL vs NoSQL, normalization vs denormalization, and real-time vs eventual consistency. Mention potential extensions like sharing links, audit logs, or fine-grained permissions.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.