Skip to content

Commit

Permalink
Refactor verify_owner for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
jvendetti committed Nov 20, 2024
1 parent d1161dd commit a88e780
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ def unescape_id
def verify_owner
return if current_user_admin?

if session[:user].nil? || (!session[:user].id.eql?(params[:id]) && !session[:user].username.eql?(params[:id]))
redirect_to controller: 'login', action: 'index', redirect: "/accounts/#{params[:id]}"
end
user = session[:user]
return if user&.id == params[:id] || user&.username == params[:id]

redirect_to login_index_path(redirect: "/accounts/#{params[:id]}")
end

def get_ontology_list(ont_hash)
Expand Down

0 comments on commit a88e780

Please sign in to comment.