mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-25 09:13:05 +08:00
Fix canaid initializer so it only uses required Gems' permissions
This should make sure that other addons that are located in /addons folder, but not actually required by the core, do not cause trouble.
This commit is contained in:
parent
e041426a09
commit
f752f82658
1 changed files with 16 additions and 1 deletions
|
@ -1,4 +1,19 @@
|
|||
Canaid.configure do |config|
|
||||
include AddonsHelper
|
||||
|
||||
config.permissions_paths << 'app/permissions/**/*.rb'
|
||||
config.permissions_paths << 'addons/**/app/permissions/**/*.rb'
|
||||
|
||||
# Include the included addons' permissions folders
|
||||
rx = %r{^.*(addons/.*/app/permissions)$}
|
||||
list_all_addons.each do |addon|
|
||||
full_path = addon::Engine
|
||||
.instance
|
||||
.config
|
||||
.eager_load_paths
|
||||
.select { |p| p.ends_with?('permissions') }
|
||||
.first
|
||||
continue unless full_path
|
||||
res = rx.match(full_path)
|
||||
config.permissions_paths << "#{res[1]}/**/*.rb" if res && res.length > 1
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue