Model Google Drive Sharing With Inherited Folder Permissions

Last updated: November 29, 2026

Quick Overview

Design classes for files and folders where users and groups receive roles (viewer, commenter, editor, owner), permissions inherit down the folder tree, and an item can break inheritance. Implement the check for whether a user may perform an action.

Google
Software Engineering Fundamentals
Software Engineer
Google
November 29, 2026
Software Engineer
Onsite
Software Engineering Fundamentals
Medium

0

0

0 solved


Design classes for files and folders where users and groups receive roles (viewer, commenter, editor, owner), permissions inherit down the folder tree, and an item can break inheritance. Implement the check for whether a user may perform an action.

Drive's permission model is a well-known Google domain and turns a standard OOD question into one with real semantics. The interviewer checks the class model, ordered roles, inheritance walk with group expansion, and how candidates reason about caching and permission changes.

What the Interviewer Expects
  • Models roles as an ordered hierarchy rather than unrelated strings
  • Walks ancestors to compute the effective role and takes the maximum
  • Expands group membership when checking grants
  • Supports an inheritance break for restricted items
  • Maps actions to minimum roles in one place
  • Discusses caching effective permissions and invalidation on moves
Key Topics to Cover
access control
inheritance
role hierarchy
group expansion
OOD
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How do you keep checks fast for deeply nested folders with millions of files?
  • What happens to effective permissions when a file moves to another folder?
  • How would you support link sharing such as anyone with the link can view?
  • How would you add deny rules, and how do they combine with allows?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • Items form a tree; folders contain files and folders.
  • share(principal, role) adds a grant; principals may be users or groups.
  • Effective role is the strongest grant on the item or any ancestor,...
High-Level Design

Item holds name, parent, children, a grants map, and an inherit flag. Roles have integer ranks so the maximum is easy. To check access, compute the user's identities (user plus groups), then walk ...


Submit Your Answer
Markdown supported