GithubHelp home page GithubHelp logo

Comments (4)

dapplion avatar dapplion commented on July 28, 2024 1

Proposal

Expose a hook called setPermissions which allows the user to customize the permission setting. The API could be similar to the app installer where a custom utility function is passed as an argument to minimize code. For example:

hooks: {
  setPermissions: async function ( { setPermission }, bre) {
    await setPermission("INCREMENT_ROLE", anotherAppInstance.address)
    await setPermission("DECREMENT_ROLE", "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
    
    // Possible keyword shortcuts
    await setPermission("ANOTHER_ROLE", "me")
    await setPermission("ANOTHER_ROLE", "rootAccount")
    await setPermission("ANOTHER_ROLE", "any")
    await setPermission("ANOTHER_ROLE", "anyEntity")
  }
}

from buidler-aragon.

sohkai avatar sohkai commented on July 28, 2024

Just wondering, is it not possible to do this at the moment? Or do we not have good utilities to make this easy?

from buidler-aragon.

0xGabi avatar 0xGabi commented on July 28, 2024

is it not possible to do this at the moment?

At this moment we assign all permission open for the proxy app. Then you can customize it on the client but not from the script.

@dapplion I like that approach. In my opinion just allowing any, anyEntity keyword. And otherwise an entity address.

from buidler-aragon.

sohkai avatar sohkai commented on July 28, 2024

Expose a hook called setPermissions

When in the hooks lifecycle would this happen? I'm primarily curious if this hook would work for setting permissions in any other apps installed rather than only scoped to the current app.

We should also default to the normal behaviour if this hook is not defined (and probably log that we're defaulting the behaviour?).

await setPermission("INCREMENT_ROLE", anotherAppInstance.address)

We may want to be careful about just using a string, but almost all apps should be exposing these as getters and so we could do an eth_call to see what the return is, and, failing that, use the hash (and warn that we couldn't find it on the app!)

// Possible keyword shortcuts

I like these! Depending on how we've communicated, I would use only one of me or rootAccount. Technically you can still get these values from the BRE, right?

However, I wonder if it'd be nicer to use an object mapping for the set of allowed values, so it's easier for the person to know if they're using a correct value. E.g. we've previously made a proxy for error mappings and could do something similar here that will throw if an incorrect value was attempted.

from buidler-aragon.

Related Issues (20)

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.