Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roles and policies filter #124

Merged
merged 23 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9d249ce
engine: added member id as a field in listOryAccessControlPolicyRoles
sum2000 Jul 16, 2019
8794a7d
sdk:generated new sdk by calling make sdk
sum2000 Jul 16, 2019
973d918
storage:added listbymember definition and implementation for memory m…
sum2000 Jul 18, 2019
5afc1fd
handler: added listbymember api and corresponding tests
sum2000 Jul 18, 2019
67c8f01
storage:cleanup test from handler tests, list member tests are in sto…
sum2000 Jul 19, 2019
40a503d
added command line support for passing member id in list roles
sum2000 Jul 19, 2019
1a1ce05
refactor:renamed ListByMember to List and removed listbymember method…
sum2000 Jul 19, 2019
ed9a448
storage: refactored memory manager list method
sum2000 Jul 19, 2019
3fb2400
docs:clear instructions for submitting pull requests in contributing.md
sum2000 Jul 19, 2019
5d520b7
storage: basic support for filtering roles and policies by query
Jul 28, 2019
328ee56
storage: added helper methods to filter roles and policies by specifi…
sum2000 Jul 28, 2019
ec421f0
storage:fixed memory manager and handler tests
sum2000 Jul 31, 2019
e874a71
ladon: filter method is passed is list requests now
sum2000 Jul 31, 2019
c835338
ladon: fixed test error
sum2000 Jul 31, 2019
42f1aad
lint:fix lint issues and line breaks
sum2000 Aug 1, 2019
3a23e8f
storage: added filter tests
sum2000 Aug 1, 2019
7374077
storage: refactor util methods
sum2000 Aug 1, 2019
14b0c47
swagger:added filter params to policy and roles list
sum2000 Aug 19, 2019
4305af3
ladon:removed policy(ies) and role(s) type from ladon, using respecti…
sum2000 Aug 19, 2019
88b85b8
storage: singularized the url query params, but they still accept mul…
sum2000 Aug 19, 2019
c05024b
storage: support for only singular param for filtering
sum2000 Aug 19, 2019
d7f588a
swagger: disabled support for multiple filter param values for list p…
sum2000 Aug 19, 2019
d8a1f1f
ladon: added handler test for roles and policies filter
sum2000 Aug 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,15 @@ To make a pull request, you will need a GitHub account; if you are unclear on th
documentation on [forking](https://help.github.com/articles/fork-a-repo) and [pull requests](https://help.github.com/articles/using-pull-requests).
Pull requests should be targeted at the `master` branch. Before creating a pull request, go through this checklist:

1. Create a feature branch off of `master` so that changes do not get mixed up.
1. [Rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) your local changes against the `master` branch.
1. Run the full project test suite with the `go test ./...` (or equivalent) command and confirm that it passes.
1. Run `gofmt -s` (if the project is written in Go).
1. Ensure that each commit has a subsystem prefix (ex: `controller: `).
1. Fork this repository and create a branch off of `master` so that changes do not get mixed up.
2. Create a local directory ory in your `$GOPATH/src/github.com`
3. `cd $GOPATH/src/github.com` and `git clone <YOUR_FORKED_REPO>`
4. Make sure `keto` resides in `$GOPATH/src/github.com/ory/keto`
5. [Rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) your local changes against the `master` branch.
6. Run the full project test suite with the `go test ./...` (or equivalent) command and confirm that it passes.
7. Run `gofmt -s` (if the project is written in Go).
8. Ensure that each commit has a subsystem prefix (ex: `controller: `).
9. To run make scripts like `make sdk`, please make sure to install [go-swagger](https://github.com/go-swagger/go-swagger/blob/master/docs/install.md) and [goreturns](https://github.com/sqs/goreturns).

Pull requests will be treated as "review requests," and maintainers will give feedback on the style and substance of the patch.

Expand Down
4 changes: 3 additions & 1 deletion cmd/engines_acp_ory_roles_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ var enginesAcpOryRolesListCmd = &cobra.Command{

limit := int64(flagx.MustGetInt(cmd, "limit"))
offset := int64(flagx.MustGetInt(cmd, "offset"))
member := flagx.MustGetString(cmd, "member")
c := client.NewClient(cmd)
r, err := c.Engines.ListOryAccessControlPolicyRoles(
engines.NewListOryAccessControlPolicyRolesParams().WithFlavor(args[0]).WithLimit(&limit).WithOffset(&offset),
engines.NewListOryAccessControlPolicyRolesParams().WithFlavor(args[0]).WithLimit(&limit).WithOffset(&offset).WithMember(&member),
)
cmdx.Must(err, "Unable to list ORY Access Control Policy Roles: %s", err)
fmt.Println(cmdx.FormatResponse(r.Payload))
Expand All @@ -48,6 +49,7 @@ var enginesAcpOryRolesListCmd = &cobra.Command{

func init() {
enginesAcpOryRolesCmd.AddCommand(enginesAcpOryRolesListCmd)
enginesAcpOryRolesListCmd.Flags().String("member", "", "Member ID for whom roles are being fetched")
enginesAcpOryRolesListCmd.Flags().Int("limit", 100, "Limit the items being fetched")
enginesAcpOryRolesListCmd.Flags().Int("offset", 0, "Set the offset for fetching items")
}
634 changes: 221 additions & 413 deletions docs/api.swagger.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions engine/ladon/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ type listOryAccessControlPolicyRoles struct {
// required: true
Flavor string `json:"flavor"`

// The Member (ID) for which the roles are to be listed (Optional).
sum2000 marked this conversation as resolved.
Show resolved Hide resolved
// in: query
// required: false
Member string `json:"member"`

// The maximum amount of policies returned.
//
// in: query
Expand Down
6 changes: 4 additions & 2 deletions engine/ladon/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func (e *Engine) Register(r *httprouter.Router) {
}

func (e *Engine) rolesList(ctx context.Context, r *http.Request, ps httprouter.Params) (*kstorage.ListRequest, error) {
var p Roles
var p kstorage.Roles

f, err := flavor(ps)
if err != nil {
Expand All @@ -299,6 +299,7 @@ func (e *Engine) rolesList(ctx context.Context, r *http.Request, ps httprouter.P
return &kstorage.ListRequest{
Collection: roleCollection(f),
Value: &p,
FilterFunc: kstorage.ListByQuery,
}, nil
}

Expand Down Expand Up @@ -426,7 +427,7 @@ func (e *Engine) policiesCreate(ctx context.Context, r *http.Request, ps httprou
}

func (e *Engine) policiesList(ctx context.Context, r *http.Request, ps httprouter.Params) (*kstorage.ListRequest, error) {
var p Policies
var p kstorage.Policies

f, err := flavor(ps)
if err != nil {
Expand All @@ -436,6 +437,7 @@ func (e *Engine) policiesList(ctx context.Context, r *http.Request, ps httproute
return &kstorage.ListRequest{
Collection: policyCollection(f),
Value: &p,
FilterFunc: kstorage.ListByQuery,
}, nil
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/go/keto/models/context.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/go/keto/models/delete_ory_access_control_policy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/go/keto/models/delete_ory_access_control_policy_role.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/go/keto/models/do_ory_access_control_policies_allow.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/go/keto/models/get_ory_access_control_policy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading