aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuc Donnet2016-11-14 21:15:31 +0100
committerLuc Donnet2016-11-14 21:15:31 +0100
commit9cfa2309d53fa45342776f7cd2972080b3b85582 (patch)
treeaa435ae46f61fd25eee29a9e8a6c9beaf620a1d2 /lib
parent552611c5a96134eff8515bbfe32870e900225bfb (diff)
parent3960264693d8ea79907b7c5619af678c69aef234 (diff)
downloadchouette-core-9cfa2309d53fa45342776f7cd2972080b3b85582.tar.bz2
Merge branch 'master' of github.com:AF83/stif-boiv
Diffstat (limited to 'lib')
-rw-r--r--lib/stif/my_workbench_scopes.rb23
-rw-r--r--lib/tasks/ci.rake1
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/stif/my_workbench_scopes.rb b/lib/stif/my_workbench_scopes.rb
new file mode 100644
index 000000000..89c4e659c
--- /dev/null
+++ b/lib/stif/my_workbench_scopes.rb
@@ -0,0 +1,23 @@
+module Stif
+ class MyWorkbenchScopes
+ attr_accessor :workbench
+
+ def initialize(workbench)
+ @workbench = workbench
+ end
+
+ def line_scope(initial_scope)
+ ids = self.parse_functional_scope
+ ids ? initial_scope.where(objectid: ids) : initial_scope
+ end
+
+ def parse_functional_scope
+ return false unless @workbench.organisation.sso_attributes
+ begin
+ JSON.parse @workbench.organisation.sso_attributes['functional_scope']
+ rescue Exception => e
+ Rails.logger.error "MyWorkbenchScopes : #{e}"
+ end
+ end
+ end
+end
diff --git a/lib/tasks/ci.rake b/lib/tasks/ci.rake
index 7fca878b6..2b584c08b 100644
--- a/lib/tasks/ci.rake
+++ b/lib/tasks/ci.rake
@@ -3,6 +3,7 @@ namespace :ci do
task :setup do
cp "config/database/jenkins.yml", "config/database.yml"
sh "RAILS_ENV=test rake db:migrate"
+ sh "npm install"
end
def git_branch