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

fix: Only admins can generate invite codes #1611

Merged
merged 2 commits into from
Jan 24, 2025

Conversation

tonyvince
Copy link
Contributor

close #1606

@hecht-a
Copy link

hecht-a commented Jan 10, 2025

Hey,
For more privacy and security I think invite codes should be hidden from non admin users

Copy link
Collaborator

@zachgoll zachgoll left a comment

Choose a reason for hiding this comment

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

Thanks @tonyvince! Looks good, just a minor suggestion.


def ensure_admin
redirect_to settings_hosting_path, alert: "You are not allowed to generate invite codes" unless Current.user.admin?
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think since we're disabling the input in the UI, we should probably just throw an exception here. A user should not be able to trigger this POST request given the UI, so if they try to side-step that, they should receive an error I think.

@tonyvince tonyvince requested a review from zachgoll January 23, 2025 10:42
Copy link
Collaborator

@zachgoll zachgoll left a comment

Choose a reason for hiding this comment

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

Looks good!

@zachgoll zachgoll merged commit 61321f6 into maybe-finance:main Jan 24, 2025
5 checks passed
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.

Bug: Self hosted invite codes should only be generated by admins
3 participants