Updated Approvable to work for submanager role also
This commit is contained in:
parent
182729a7fe
commit
635f82db2f
|
@ -14,7 +14,7 @@ class OrbitBackendController < ApplicationController
|
||||||
status << 'is_top'
|
status << 'is_top'
|
||||||
status << 'is_hot'
|
status << 'is_hot'
|
||||||
status << 'is_hidden' unless is_guest?
|
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_pending'
|
||||||
status << 'is_checked'
|
status << 'is_checked'
|
||||||
status << 'is_rejected'
|
status << 'is_rejected'
|
||||||
|
|
|
@ -14,7 +14,7 @@ class OrbitMemberController < ApplicationController
|
||||||
status << 'is_top'
|
status << 'is_top'
|
||||||
status << 'is_hot'
|
status << 'is_hot'
|
||||||
status << 'is_hidden' unless is_guest?
|
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_pending'
|
||||||
status << 'is_checked'
|
status << 'is_checked'
|
||||||
status << 'is_rejected'
|
status << 'is_rejected'
|
||||||
|
|
|
@ -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?)
|
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
|
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?)
|
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
|
by_object and by_user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,6 @@ class ModuleApp
|
||||||
|
|
||||||
def update_auth_sub_manager_users
|
def update_auth_sub_manager_users
|
||||||
user_ids = self.auth_sub_managers.inject([]) do |users, auth|
|
user_ids = self.auth_sub_managers.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_sub_manager_users, user_ids.uniq)
|
self.update_attribute(:auth_sub_manager_users, user_ids.uniq)
|
||||||
|
|
Reference in New Issue