Updated Approvable to work for submanager role also

This commit is contained in:
saurabhbhatia 2013-11-13 09:53:21 +08:00
parent 182729a7fe
commit 635f82db2f
4 changed files with 4 additions and 5 deletions

View File

@ -14,7 +14,7 @@ class OrbitBackendController < ApplicationController
status << 'is_top'
status << 'is_hot'
status << 'is_hidden' unless is_guest?
if @module_app.is_approvable && is_manager?
if @module_app.is_approvable && (is_manager? || is_sub_manager?)
status << 'is_pending'
status << 'is_checked'
status << 'is_rejected'

View File

@ -14,7 +14,7 @@ class OrbitMemberController < ApplicationController
status << 'is_top'
status << 'is_hot'
status << 'is_hidden' unless is_guest?
if @module_app.is_approvable && is_manager?
if @module_app.is_approvable && (is_manager? || is_sub_manager?)
status << 'is_pending'
status << 'is_checked'
status << 'is_rejected'

View File

@ -12,13 +12,13 @@ module OrbitBackendHelper
def show_form_status_field(object)
#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?)
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
end
def show_approval_link(object)
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?)
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_object and by_user
end

View File

@ -196,7 +196,6 @@ class ModuleApp
def update_auth_sub_manager_users
user_ids = self.auth_sub_managers.inject([]) do |users, auth|
auth = auth.class.find(auth.id)
users += auth.authorized_users.map{|user| user.id}
end
self.update_attribute(:auth_sub_manager_users, user_ids.uniq)