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 support for sudo and mu auth scope #30

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Riadabd
Copy link
Contributor

@Riadabd Riadabd commented Apr 19, 2024

Description

This PR contains similar changes to mu-semtech/mu-javascript-template@56e185e .

It extends the query and update functions and provides a transition path to using scopes instead of sudo where possible (once the scopes feature lands).

Copy link
Member

@erikap erikap left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @Riadabd 🙏
I think it's best to keep it as close to the behaviour of the mu-javascript-template as possible.

mu.rb Outdated Show resolved Hide resolved
mu.rb Outdated Show resolved Hide resolved
if Mu::truthy? ENV['ALLOW_MU_AUTH_SUDO']
options[:headers] = { 'mu-auth-sudo': 'true' }
else
log.error "Error, sudo request but service lacks ALLOW_MU_AUTH_SUDO header"
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we also raise an error here instead of only logging one? Query will now still be executed with a non-sudo SPARQL client.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I go with raise?

raise "Error, sudo request but service lacks ALLOW_MU_AUTH_SUDO header"

Copy link
Member

Choose a reason for hiding this comment

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

Yes, seems more in line with the JS template to me 👍

mu.rb Show resolved Hide resolved
mu.rb Show resolved Hide resolved
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