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

Add permissions middleware #125

Merged
merged 2 commits into from
Jun 22, 2023
Merged

Conversation

mikemrm
Copy link
Contributor

@mikemrm mikemrm commented Jun 22, 2023

Produces an echo middleware which adds a checker function into the
request context that is later used to check if the current actor has
access to the requesting resource and action.

Signed-off-by: Mike Mason <[email protected]>
@mikemrm mikemrm marked this pull request as ready for review June 22, 2023 20:35
@mikemrm mikemrm requested review from a team as code owners June 22, 2023 20:35
Copy link
Contributor

@fishnix fishnix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just the one change - otherwise looks good!

func New(config Config, options ...Option) (*Permissions, error) {
p := &Permissions{
enabled: config.URL != "",
client: http.DefaultClient,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use a sane client with a really short timeout instead of the default client

Copy link
Contributor

@fishnix fishnix Jun 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(unless you think its better for implementers to pass a client - but that feels like a 🦶 🔫 )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah fair point

Produces an echo middleware which adds a checker function into the
request context that is later used to check if the current actor has
access to the requesting resource and action.

Signed-off-by: Mike Mason <[email protected]>
@mikemrm mikemrm merged commit 64e1a86 into infratographer:main Jun 22, 2023
@mikemrm mikemrm deleted the add-permissions-mdw branch June 22, 2023 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants