Giter Site home page Giter Site logo

bdargan / expr-def Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 23 KB

Exploration of custom permissions and authorization This is not a library, just an exploration of concepts from a great blog article: How We Built a Custom Permissions DSL at Figma | Figma Blog

TypeScript 98.85% JavaScript 1.15%

expr-def's Introduction

Exploration of custom permissions and authorization

This is not a library, just an exploration of concepts from a great blog article: How We Built a Custom Permissions DSL at Figma | Figma Blog

Goal is to see how policies in code might work for various use cases. Ideally these could be in a variety of locations within a stack.

I expect the combination of Database loader with context path mapping should obscure implementation details that simplifies the policy expressions (and support tables or JSON based data forms). I use REST and/or GraphQL so examples with restricted field/column access need to be added.

Example:

pnpm go

✅ allow owner view file 1?

✅ deny guest view file owned by another

✅ deny deleted user from view file

✅ allow user to view a file shared by another

Add more scenarios and examples

  • public url access (viewers, commenters, editors etc.)
  • tiny todo access
  • Column / field restrictions. GQL deniedFields

Explore alternative evaluation engine and/or policy serialization with jsonata

//   const expression = jsonata('$sum(example.value)');
//   const result = await expression.evaluate(data);  // returns 24
// })()

Data loader

Policy in code provides a known static list of dependencies, but I won't fully explore the figma path at this stage.

From the resource (in this case, a file) and user object, we can infer all the queries we need in order to load all required resources. We can imagine there being four groups of resources:

  1. Resources known at call time (file and user).
  2. Resources loaded through references / foreign keys in main resource object (through file).
  3. Resources loaded through columns in user object.

expr-def's People

Contributors

bdargan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.