Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Support scopes #2

Closed
phyrog opened this issue Aug 4, 2017 · 0 comments
Closed

Support scopes #2

phyrog opened this issue Aug 4, 2017 · 0 comments
Assignees
Milestone

Comments

@phyrog
Copy link
Collaborator

phyrog commented Aug 4, 2017

Pundit supports the concept of scopes (basically filters for lists and list-like data).

We could support them with a scope instrumenter receiving a lambda, that in turn receives the usual root, arguments, context arguments.

We could then combine the scope instrumenter with the resource instrumenter like this:

resource ->(orgUnit, _args, _ctx) { orgUnit.repositories }
scope ->(repos, _args, _ctx) { RepositoryPolicy::Scope.new(current_user, repos).resolve }
resolve ->(filtered_repos, _args, _ctx) { filtered_repos }

or similar (with less boilerplate), but the gist is resource (-> authorize) -> scope -> resolve.

@phyrog phyrog modified the milestone: v0.2 Aug 7, 2017
@phyrog phyrog self-assigned this Aug 12, 2017
@phyrog phyrog mentioned this issue Sep 1, 2017
@phyrog phyrog closed this as completed in #11 Sep 6, 2017
@phyrog phyrog removed the in review label Sep 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants