From f1b4d9e2047951bc2a7d42fe7b6ea2f016df21a3 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Sun, 12 Aug 2012 23:29:13 +0800 Subject: [PATCH] Add authorization for rescue interface Change logic for NCCU site for status panel. --- app/controllers/pages_controller.rb | 1 - config/initializers/resque_auth.rb | 3 +++ config/locales/zh_tw.yml | 2 +- .../helpers/panel/announcement/back_end/bulletins_helper.rb | 4 ++-- vendor/built_in_modules/announcement/app/models/bulletin.rb | 2 +- .../panel/announcement/widget/bulletins/_bulletins.html.erb | 2 +- .../app/helpers/panel/news/back_end/news_bulletins_helper.rb | 4 ++-- 7 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 config/initializers/resque_auth.rb diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 053660a51..c4ee33c01 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -16,7 +16,6 @@ class PagesController < ApplicationController def show #begin - @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)) impressionist(@item) diff --git a/config/initializers/resque_auth.rb b/config/initializers/resque_auth.rb new file mode 100644 index 000000000..6f31043d8 --- /dev/null +++ b/config/initializers/resque_auth.rb @@ -0,0 +1,3 @@ +Resque::Server.use(Rack::Auth::Basic) do |user, password| + password == "SD-7506D" +end \ No newline at end of file diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 28bc5e1dc..101b456bf 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -148,7 +148,7 @@ zh_tw: create_success_snippet: 片段已成功新增。 create_success_user: 用戶已成功新增。。 dashboard: 儀表板 - data: 資料數據 + data: 選擇檔案 delete_language: 刪除語言 description: 描述 design: 版型管理 diff --git a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb index a71b4965a..844ee4e4d 100644 --- a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb +++ b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb @@ -1,8 +1,8 @@ module Panel::Announcement::BackEnd::BulletinsHelper 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_bulletin and by_user + by_user end def show_approval_link(bulletin) diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index a3963babd..2357e352a 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -222,7 +222,7 @@ class Bulletin end 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 diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_bulletins.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_bulletins.html.erb index 2fd92680a..41311c390 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_bulletins.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_bulletins.html.erb @@ -1,6 +1,6 @@ <% @bulletins.each do |bulletin| %>
  • - <%= 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 ) %>
  • <% end %> diff --git a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb index f4bd1ee3f..24de272b6 100644 --- a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb +++ b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb @@ -1,8 +1,8 @@ module Panel::News::BackEnd::NewsBulletinsHelper 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_news_bulletin and by_user + by_user end def news_show_approval_link(news_bulletin)