我们如何在 Figma 构建了一个自定义权限 DSL

Collaboration is core to Figma. It’s why we built Figma on the web, and why multiplayer is such an important part of the Figma editor. This focus on collaboration also means that our permissions rules are complex—deceptively so. In early 2021, the engineering team encountered a number of bugs, support tickets, and delayed projects rooted in this complexity. The challenge? We had to rethink the technical foundations of our permissions engine to make sure that engineers could add, modify, and remove rules without worrying about breaking something.

协作是Figma的核心。这就是为什么我们在Web上构建Figma的原因,以及为什么多人协作是Figma编辑器的重要组成部分。这种关注协作也意味着我们的权限规则是复杂的,甚至是具有欺骗性的。在2021年初,工程团队遇到了许多与这种复杂性相关的错误、支持票和延迟项目。挑战在于,我们必须重新思考我们权限引擎的技术基础,以确保工程师可以添加、修改和删除规则,而不必担心破坏任何东西。

When it comes to the “build” versus “buy” debate, we tend to bias towards using existing open source or off-the-shelf solutions. In this case, we opted to create our own permissions domain specific language (DSL), a custom cross-platform logic engine, and migrate all our most important permissions rules into this system.

当涉及到“构建”与“购买”的辩论时,我们倾向于使用现有的开源或现成的解决方案。在这种情况下,我们选择创建自己的权限领域特定语言(DSL),一个自定义的跨平台逻辑引擎,并将所有最重要的权限规则迁移到这个系统中。

Before getting into why we arrived at this solution, it’s important to understand how this connects to the Figma user experience. Let’s start with what we call the “share” modal. This is certainly not the only place where permissions are used, but it’s one of the most visible and one of the most complex.

在深入了解为什么我们采用了这种解决方案之前,了解这与Figma用户体验的关系非常重要。让我们从我们称之为“共享”模态框开始。这当然不是唯一使用权限的地方,但它是最可见和最复杂的之一。

When you click on the “Share” button in a Figma file, the share modal pops up, which controls who can access the file and their corresponding level of authorship. There are two main ways to access a file: through a role and through a link. Roles are hierarchical, so you might have access to the file through your role on a parent folder, team, or organization. We have corresponding rules around when that access is blocked or allowed depending on the state of each of these conta...

开通本站会员,查看完整译文。

- 위키
Copyright © 2011-2024 iteam. Current version is 2.137.1. UTC+08:00, 2024-11-08 21:47
浙ICP备14020137号-1 $방문자$