Skip to content

Commit b0c08f5

Browse files
committed
fix: is_authenticated should return false if no site or no current user
1 parent 511a3c5 commit b0c08f5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

config/initializers/maglev.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
# Editor UI authentication (https://docs.maglev.dev/guides/setup-authentication)
3838
# config.is_authenticated = :editor_allowed? # name of any protected method from your Rails application controller
3939
config.is_authenticated = ->(site) do
40+
return false if !site || !current_user
4041
Rails.logger.info "🔐 site##{site.id} owned by user##{site.siteable.user_id} and requested by user##{current_user&.id}"
4142
site.siteable.user_id == current_user&.id
4243
end

0 commit comments

Comments
 (0)