Skip to content
This repository was archived by the owner on Jul 27, 2025. It is now read-only.

fix: Only admins can generate invite codes#1611

Merged
zachgoll merged 2 commits intomaybe-finance:mainfrom
tonyvince:fix-1606
Jan 24, 2025
Merged

fix: Only admins can generate invite codes#1611
zachgoll merged 2 commits intomaybe-finance:mainfrom
tonyvince:fix-1606

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
Contributor

@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
Contributor

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
Contributor

@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 subscribe to this conversation on GitHub. Already have an account? Sign in.

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