1.make module app forbid unearthed access except from admin
2.override sidebar link when it's object_auth or app_auth.
This commit is contained in:
1 parent
15be80a35f
commit
4a08a1992b
6 files changed
+39
-6
No files matched your search
@@ -138,9 +138,9 @@ module OrbitApp
|
||||
|
||||
def initialize(label_i18n="NoNameLink",options={})
|
||||
@label_i18n = label_i18n
|
||||
@available_for = options[:available_for]
|
||||
@priority = options[:priority] || 0
|
||||
@path = options[:link_path] || ""
|
||||
set_available_for_avoiding_sensitive_links(options[:available_for] )
|
||||
@active_for_action = options[:active_for_action] || []
|
||||
@active_for_object_auth = options[:active_for_object_auth] || []
|
||||
@active_for_app_auth = options[:active_for_app_auth] || []
|
||||
@@ -148,6 +148,24 @@ module OrbitApp
|
||||
@get_module_app = options[:get_module_app]
|
||||
end
|
||||
|
||||
def set_available_for_avoiding_sensitive_links(available_for)
|
||||
sensitive_list = {}
|
||||
sensitive_list[:module_app] =/.*manager_auth_proc.*/
|
||||
sensitive_list[:object_auth] = /.*object_auth.*/
|
||||
|
||||
sensitive_list.each do |index,regx|
|
||||
if @path.match(regx)
|
||||
@available_for = case index
|
||||
when :module_app
|
||||
[:admin]
|
||||
when :object_auth
|
||||
[:manager,:admin]
|
||||
end #of case
|
||||
end #of if
|
||||
end #of each
|
||||
@available_for = available_for if @available_for.nil?
|
||||
end #of def
|
||||
|
||||
def get_module_app
|
||||
@get_module_app.call
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user