diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index f5e3314bb..7220eec27 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -91,8 +91,12 @@ class BlogCommentsController < ApplicationController def edit @article = BlogComment.find(params[:id]) - respond_to do |format| - format.html {render :layout=>'new_base_user'} + if User.current.admin? || User.current.id == @article.author_id + respond_to do |format| + format.html { render :layout => 'new_base_user' } + end + else + render_403 end end diff --git a/app/views/blog_comments/edit.html.erb b/app/views/blog_comments/edit.html.erb index 704342fc0..1e29d0a14 100644 --- a/app/views/blog_comments/edit.html.erb +++ b/app/views/blog_comments/edit.html.erb @@ -1,6 +1,5 @@ -<% if User.current.logged? && User.current.id == @user.id %> - <%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage],:in_act => params[:in_act]},:method=>'PUT', - :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %> - <%= render :partial => 'blog_comments/edit', :locals => {:f => f, :article => @article, :edit_mode => true, :user => @user} %> - <% end %> -<% end %> \ No newline at end of file + +<%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage],:in_act => params[:in_act]},:method=>'PUT', + :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %> + <%= render :partial => 'blog_comments/edit', :locals => {:f => f, :article => @article, :edit_mode => true, :user => @user} %> +<% end %> diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index c80274db4..de7f1647d 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -38,7 +38,7 @@ <%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %>
- <% if @article.author.id == User.current.id%> + <% if @article.author.id == User.current.id || User.current.admin? %>
- <% if activity.author.id == User.current.id%> + <% if activity.author.id == User.current.id || User.current.admin? %>