Skip to content

Commit

Permalink
Correct comments and add guard against submitter profile not being pr…
Browse files Browse the repository at this point in the history
…esent
  • Loading branch information
Janell-Huyck committed Jan 31, 2024
1 parent d9e68c5 commit 299ef5c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/controllers/concerns/submitter_ownership_guard.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# frozen_string_literal: true

# The SubmitterOwnedContentGuard module is a concern for Rails controllers that provides
# The SubmitterOwnershipGuard module is a concern for Rails controllers that provides
# functionality to restrict access to resources based on the submitter's identity.
# It defines a set of before actions to check if the current user (submitter) is authorized
# to access a given resource. This module handles special cases for submitters and ensures
# that access is granted only if the user's session matches the submitter_id associated
# with the resource. It's included in the application controller and is skipped for
# controllers that don't require submitter authentication (e.g. pages, errors, etc.).
# with the resource. It's included in the publications and submitters controllers
#
# "Index" is skipped because it has its own logic to determine what can be shown.
module SubmitterOwnershipGuard
Expand Down Expand Up @@ -39,7 +38,7 @@ def current_submitter_is_owner?
def submitter_owns_profile?
submitter = Submitter.find(params[:id])

logged_in_submitter_id == submitter.id.to_s
submitter && (logged_in_submitter_id == submitter.id.to_s)
end

def submitter_owns_publication?
Expand Down

0 comments on commit 299ef5c

Please sign in to comment.