diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/stif/my_workbench_scopes.rb | 22 |
1 files changed, 22 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..ed3432ad3 --- /dev/null +++ b/lib/stif/my_workbench_scopes.rb @@ -0,0 +1,22 @@ +class Stif::MyWorkbenchScopes + attr_accessor :organisation + + def initialize(workbench) + @workbench = workbench + end + + def line_scope + scope = Chouette::Line + ids = self.parse_functional_scope + ids ? scope.where(objectid: ids) : scope.all + end + + def parse_functional_scope + return false unless @workbench.organisation.sso_attributes + begin + line_ids = JSON.parse @workbench.organisation.sso_attributes['functional_scope'] + rescue Exception => e + Rails.logger.error "MyWorkbenchScopes : #{e}" + end + end +end |
