mercurius-js / auth

Mercurius Auth Plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature: multiple directive

Eomm opened this issue · comments

It would be great to support multiple directives:

  • @hasRole
  • @hasPermission

Example:

type Article {
  id: ID!
  title: String!
  content: String! @hasPermission(resources: ["subscribed"])
}

type Query {
  listArticles: [Article]!
}

type Mutation {
  publishArticle(articleId: ID!): Article! @hasRole(role: "editor")
  unpublishArticle(articleId: ID!):Boolean @hasPermission(resources: ["publish","delete"])
}

Doing so, it should be open to integrating external Identity Management such as:

Great idea! I think it's currently possible to do this in the meantime by registering the plugin twice?

Either way, I think this would be great feature to explicitly support, would you be interested in submitting a PR for this?

Yes @jonnydgreen, I'm working on it

Could you assign me this issue?

I wonder if it's currently possible to do this in the meantime by registering the plugin twice?

I will try it and add tests&docs if it works

Awesome, thanks and thanks!