Add authorization for rescue interface

Change logic for NCCU site for status panel.
This commit is contained in:
Matthew K. Fu JuYuan 2012-08-12 23:29:13 +08:00
parent 6059edad70
commit f1b4d9e204
7 changed files with 10 additions and 8 deletions

View File

@ -16,7 +16,6 @@ class PagesController < ApplicationController
def show def show
#begin #begin
@item = Item.first(:conditions => {:path => params[:page_name]}) @item = Item.first(:conditions => {:path => params[:page_name]})
if @item && @item.is_published #&& (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s)) if @item && @item.is_published #&& (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
impressionist(@item) impressionist(@item)

View File

@ -0,0 +1,3 @@
Resque::Server.use(Rack::Auth::Basic) do |user, password|
password == "SD-7506D"
end

View File

@ -148,7 +148,7 @@ zh_tw:
create_success_snippet: 片段已成功新增。 create_success_snippet: 片段已成功新增。
create_success_user: 用戶已成功新增。。 create_success_user: 用戶已成功新增。。
dashboard: 儀表板 dashboard: 儀表板
data: 資料數據 data: 選擇檔案
delete_language: 刪除語言 delete_language: 刪除語言
description: 描述 description: 描述
design: 版型管理 design: 版型管理

View File

@ -1,8 +1,8 @@
module Panel::Announcement::BackEnd::BulletinsHelper module Panel::Announcement::BackEnd::BulletinsHelper
def show_form_status_field(bulletin) def show_form_status_field(bulletin)
by_bulletin = (!bulletin.is_expired? and bulletin.is_pending?) #by_bulletin = (!bulletin.is_expired? and bulletin.is_pending?)
by_user = ((bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?) by_user = ((bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)
by_bulletin and by_user by_user
end end
def show_approval_link(bulletin) def show_approval_link(bulletin)

View File

@ -222,7 +222,7 @@ class Bulletin
end end
def fetch_dept def fetch_dept
self.cache_dept = (User.current.cache_dept rescue nil) || (User.find(self.create_user_id).cache_dept rescue nil) self.cache_dept = User.find(self.create_user_id).cache_dept rescue nil
end end
end end

View File

@ -1,6 +1,6 @@
<% @bulletins.each do |bulletin| %> <% @bulletins.each do |bulletin| %>
<li> <li>
<%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id) %> <%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id ,:tag_id=>bulletin.tags.first.id ) %>
</li> </li>
<% end %> <% end %>

View File

@ -1,8 +1,8 @@
module Panel::News::BackEnd::NewsBulletinsHelper module Panel::News::BackEnd::NewsBulletinsHelper
def news_show_form_status_field(news_bulletin) def news_show_form_status_field(news_bulletin)
by_news_bulletin = (!news_bulletin.is_expired? and news_bulletin.is_pending?) #by_news_bulletin = (!news_bulletin.is_expired? and news_bulletin.is_pending?)
by_user = ((news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?) by_user = ((news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)
by_news_bulletin and by_user by_user
end end
def news_show_approval_link(news_bulletin) def news_show_approval_link(news_bulletin)