Skip to content

Commit 2ccb3ce

Browse files
author
darora
committed
Users should not be able to see each other's details, unless they are an admin
1 parent 57b60e3 commit 2ccb3ce

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/sinatra-authentication.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ def self.registered(app)
3030
app.get '/users/:id/?' do
3131
login_required
3232

33+
if params[:id].to_i != current_user.id and !current_user.admin?
34+
redirect "/"
35+
end
3336
@user = User.get(:id => params[:id])
3437
send options.template_engine, get_view_as_string("show.#{options.template_engine}"), :layout => use_layout?
3538
end

0 commit comments

Comments
 (0)