Fix approval issue

This commit is contained in:
Spen 2014-02-13 16:13:54 +08:00 committed by Manson Wang
parent 38124e41b5
commit f308b8a34c
6 changed files with 15 additions and 4 deletions

View File

@ -1,6 +1,7 @@
class OrbitBackendController < ApplicationController class OrbitBackendController < ApplicationController
include OrbitCategory::Categorizing include OrbitCategory::Categorizing
include OrbitCoreLib::Authorization include OrbitCoreLib::Authorization
include OrbitCoreLib::PermissionUtility
include OrbitTag::Tagging include OrbitTag::Tagging
include AdminHelper include AdminHelper
include ApplicationHelper include ApplicationHelper

View File

@ -12,13 +12,13 @@ module OrbitBackendHelper
def show_form_status_field(object) def show_form_status_field(object)
#by_object = (!object.is_expired? and object.is_pending?) #by_object = (!object.is_expired? and object.is_pending?)
by_user = ((object.category.authed_users("approval_#{@module_app.key}").include?(current_user) rescue nil) or is_manager? or is_admin? or is_sub_manager?) by_user = ((object.category.user_is_authorized_by_title?(current_user,"category_approval_#{@module_app.key}") rescue nil) or is_manager? or is_admin?)
by_user by_user
end end
def show_approval_link(object) def show_approval_link(object)
by_object = (!object.is_expired? and object.is_pending?) by_object = (!object.is_expired? and object.is_pending?)
by_user = ((object.category.authed_users("approval_#{@module_app.key}").include?(current_user) rescue nil) or is_manager? or is_admin? or is_sub_manager?) by_user = ((object.category.user_is_authorized_by_title?(current_user,"category_approval_#{@module_app.key}") rescue nil) or is_manager? or is_admin?)
by_object and by_user by_object and by_user
end end
@ -306,7 +306,7 @@ module OrbitBackendHelper
content_tag :li, link_to(t(quick[:translation] || :authorization_), eval("#{quick[:link]}"), class: "preview_trigger #{quick[:class]}") content_tag :li, link_to(t(quick[:translation] || :authorization_), eval("#{quick[:link]}"), class: "preview_trigger #{quick[:class]}")
end end
when 'edit' when 'edit'
if authorization && approvable if authorization && approvable || is_manager?
content_tag :li, link_to(t(quick[:translation] || :edit), quick[:link].nil? ? '#' : eval("#{quick[:link]}('#{object.id}'#{link_option})"), class: quick[:class], data: eval("#{quick[:data]}")) content_tag :li, link_to(t(quick[:translation] || :edit), quick[:link].nil? ? '#' : eval("#{quick[:link]}('#{object.id}'#{link_option})"), class: quick[:class], data: eval("#{quick[:data]}"))
end end
when 'delete' when 'delete'

View File

@ -194,6 +194,7 @@ class ModuleApp
# authorization # authorization
def update_auth_approval_users def update_auth_approval_users
user_ids = self.auth_approvals.inject([]) do |users, auth| user_ids = self.auth_approvals.inject([]) do |users, auth|
auth = auth.class.find(auth.id)
users += auth.authorized_users.map{|user| user.id} users += auth.authorized_users.map{|user| user.id}
end end
self.update_attribute(:auth_approval_users, user_ids.uniq) self.update_attribute(:auth_approval_users, user_ids.uniq)

View File

@ -229,11 +229,13 @@ en:
groups: Groups groups: Groups
help: Help help: Help
hidden: Hidden hidden: Hidden
is_hidden: Hidden
hide: Hide hide: Hide
hits: Hits hits: Hits
homepage: Homepage homepage: Homepage
horizontal: Horizontal horizontal: Horizontal
hot: Hot hot: Hot
is_hot: Hot
image: Image image: Image
images: Images images: Images
info: Information info: Information
@ -352,11 +354,13 @@ en:
public_r_tag: System Widget public_r_tag: System Widget
text: Text Area text: Text Area
passed: Approved passed: Approved
is_checked: Approved
password: Password password: Password
password_change: Change password password_change: Change password
password_confirmation: Password confirmation password_confirmation: Password confirmation
password_current: Current password password_current: Current password
pending: Pending pending: Pending
is_pending: Pending
personal_plugins: personal_plugins:
author : "Author" author : "Author"
edit_brief_intro : "Edit Brief Intro." edit_brief_intro : "Edit Brief Intro."
@ -400,6 +404,7 @@ en:
register: Register register: Register
registered: Registered registered: Registered
rejected: Rejected rejected: Rejected
is_rejected: Rejected
rejected_reason: 'Reason:' rejected_reason: 'Reason:'
rejected_reason_empty: "Approval rejected, no referencable information" rejected_reason_empty: "Approval rejected, no referencable information"
related_links: Related Links related_links: Related Links
@ -527,6 +532,7 @@ en:
to_search: Set as Search Key to_search: Set as Search Key
to_show: Display in frontend to_show: Display in frontend
top: Top top: Top
is_top: Top
total_visitors: Total Visitors total_visitors: Total Visitors
traffic: Traffic traffic: Traffic
type: Field Type type: Field Type

View File

@ -355,11 +355,13 @@ zh_tw:
public_r_tag: 系統模塊 public_r_tag: 系統模塊
text: 文字區域 text: 文字區域
passed: 通過審核 passed: 通過審核
is_checked: 通過審核
password: 密碼 password: 密碼
password_change: 更改密碼 password_change: 更改密碼
password_confirmation: 確認密碼 password_confirmation: 確認密碼
password_current: 目前的密碼 password_current: 目前的密碼
pending: 待審核 pending: 待審核
is_pending: 待審核
personal_plugins: personal_plugins:
author : "著作人" author : "著作人"
edit_brief_intro : "編輯摘要" edit_brief_intro : "編輯摘要"
@ -402,6 +404,7 @@ zh_tw:
register: 註冊 register: 註冊
registered: 已註冊 registered: 已註冊
rejected: 拒絕 rejected: 拒絕
is_rejected: 拒絕
rejected_reason: 拒絕原因:' rejected_reason: 拒絕原因:'
rejected_reason_empty: "拒絕核准, 沒有參考資訊" rejected_reason_empty: "拒絕核准, 沒有參考資訊"
related_links: 相關連結 related_links: 相關連結

View File

@ -234,7 +234,7 @@ module OrbitCoreLib
when :sub_manager when :sub_manager
@open ||= check_sub_manager @open ||= check_sub_manager
when :approver when :approver
@open ||= check_sub_manager @open ||= check_approver
when :user when :user
@open ||= true @open ||= true
when :visitor when :visitor