don't show non-site-admin-relavant tabs in site admin subaccounts
test plan: * go to a subaccount in site admin * you should not see courses, statistics, outcomes, rubrics, grading, question banks, or admin tools Change-Id: I11e66273a07b29b3349da7e4dd680b7632485591 Reviewed-on: https://gerrit.instructure.com/61261 Reviewed-by: Rob Orton <rob@instructure.com> Tested-by: Jenkins QA-Review: August Thornton <august@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
570e6d3165
commit
d46b3d3497
|
@ -1283,15 +1283,15 @@ class Account < ActiveRecord::Base
|
|||
|
||||
def tabs_available(user=nil, opts={})
|
||||
manage_settings = user && self.grants_right?(user, :manage_account_settings)
|
||||
if site_admin?
|
||||
if root_account.site_admin?
|
||||
tabs = []
|
||||
tabs << { :id => TAB_USERS, :label => t('#account.tab_users', "Users"), :css_class => 'users', :href => :account_users_path } if user && self.grants_right?(user, :read_roster)
|
||||
tabs << { :id => TAB_PERMISSIONS, :label => t('#account.tab_permissions', "Permissions"), :css_class => 'permissions', :href => :account_permissions_path } if user && self.grants_right?(user, :manage_role_overrides)
|
||||
tabs << { :id => TAB_SUB_ACCOUNTS, :label => t('#account.tab_sub_accounts', "Sub-Accounts"), :css_class => 'sub_accounts', :href => :account_sub_accounts_path } if manage_settings
|
||||
tabs << { :id => TAB_AUTHENTICATION, :label => t('#account.tab_authentication', "Authentication"), :css_class => 'authentication', :href => :account_authentication_providers_path } if manage_settings
|
||||
tabs << { :id => TAB_PLUGINS, :label => t("#account.tab_plugins", "Plugins"), :css_class => "plugins", :href => :plugins_path, :no_args => true } if self.grants_right?(user, :manage_site_settings)
|
||||
tabs << { :id => TAB_JOBS, :label => t("#account.tab_jobs", "Jobs"), :css_class => "jobs", :href => :jobs_path, :no_args => true } if self.grants_right?(user, :view_jobs)
|
||||
tabs << { :id => TAB_DEVELOPER_KEYS, :label => t("#account.tab_developer_keys", "Developer Keys"), :css_class => "developer_keys", :href => :developer_keys_path, :no_args => true } if self.grants_right?(user, :manage_developer_keys)
|
||||
tabs << { :id => TAB_AUTHENTICATION, :label => t('#account.tab_authentication', "Authentication"), :css_class => 'authentication', :href => :account_authentication_providers_path } if root_account? && manage_settings
|
||||
tabs << { :id => TAB_PLUGINS, :label => t("#account.tab_plugins", "Plugins"), :css_class => "plugins", :href => :plugins_path, :no_args => true } if root_account? && self.grants_right?(user, :manage_site_settings)
|
||||
tabs << { :id => TAB_JOBS, :label => t("#account.tab_jobs", "Jobs"), :css_class => "jobs", :href => :jobs_path, :no_args => true } if root_account? && self.grants_right?(user, :view_jobs)
|
||||
tabs << { :id => TAB_DEVELOPER_KEYS, :label => t("#account.tab_developer_keys", "Developer Keys"), :css_class => "developer_keys", :href => :developer_keys_path, :no_args => true } if root_account? && self.grants_right?(user, :manage_developer_keys)
|
||||
else
|
||||
tabs = []
|
||||
tabs << { :id => TAB_COURSES, :label => t('#account.tab_courses', "Courses"), :css_class => 'courses', :href => :account_path } if user && self.grants_right?(user, :read_course_list)
|
||||
|
@ -1319,7 +1319,7 @@ class Account < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def can_see_admin_tools_tab?(user)
|
||||
return false if !user || site_admin?
|
||||
return false if !user || root_account.site_admin?
|
||||
admin_tool_permissions = RoleOverride.manageable_permissions(self).find_all{|p| p[1][:admin_tool]}
|
||||
admin_tool_permissions.any? do |p|
|
||||
self.grants_right?(user, p.first)
|
||||
|
|
Loading…
Reference in New Issue