From b49c582c6ea07db196a959217b794f9693f46988 Mon Sep 17 00:00:00 2001 From: manson Date: Tue, 15 Jul 2014 16:02:52 +0800 Subject: [PATCH] Fix _profile.html.erb removed is_admin? --- app/views/plugin/book/_profile.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/plugin/book/_profile.html.erb b/app/views/plugin/book/_profile.html.erb index d45e489..278071b 100644 --- a/app/views/plugin/book/_profile.html.erb +++ b/app/views/plugin/book/_profile.html.erb @@ -23,7 +23,8 @@ @filter = {new_filter[:type] => [new_filter[:id].to_s]} end - if @member && @member.user.is_admin? + is_autorized_user = (current_user==@member.user || current_user.is_admin?) + if is_autorized_user @books = Book.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10) else @books = Book.where(is_hidden: false, member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)