infopark_fiona7 1.5.5.4.1 → 1.5.5.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 680cc8e643912cbbf98dc96eb8efd1d66cec19a3
4
- data.tar.gz: d56bd4c52dad56d36e435679a40a5826198ebb75
3
+ metadata.gz: cf226dd1d9eefb04c31a6a9d43f8d613578af159
4
+ data.tar.gz: 9be472d5297f419fc0ce2d9ef605b09aaa48552b
5
5
  SHA512:
6
- metadata.gz: 219685c11a611e89cdd60c49643b57050b06c8d3aedaa5903b4766fa0b555440d8ecf4fec0ce58b62c1d206859d6541e6a2d47db646f556100f18e3a21ff22e7
7
- data.tar.gz: a9a75d826d516430bd09e4dae365bc8221c77cdd48141797ac53b61fad6a707af19fecfc17981489ceaf2865d60a23ab4b0d7c5d2674dac7cf2c83ff20447f50
6
+ metadata.gz: 5dd1d35a27b86f3601923ab62bf38c0bccfbde1cef1d1cb9480369de2482ac8c062e5017d908c413b79c1011a7dd508dddee9a20c3c3870c1e344df80dcbd73a
7
+ data.tar.gz: 25968a661a3f890cd643ab186cb6e29bc04facb8dab7a7c183c4525d573453ae26d2745acbe08158a8360ac58775330034273bc92065b55c2a21dfb45d2bbf03
@@ -4,16 +4,16 @@ module Fiona7
4
4
  class TasksController < ActionController::Base
5
5
  def index
6
6
  @details_view = self.details_view_lambda
7
- @tasks = Fiona7::Tasks::Loader.new(self.user_name).call
7
+ @tasks = Fiona7::Tasks::Loader.new(self.user_name, self.groups).call
8
8
  end
9
9
 
10
10
  protected
11
11
  def user_name
12
- if params[:mode] == 'user'
13
- rsession.user_name
14
- else
15
- nil
16
- end
12
+ rsession.user_name
13
+ end
14
+
15
+ def groups
16
+ rsession.user.groups unless params[:mode] == 'user'
17
17
  end
18
18
 
19
19
 
@@ -212,13 +212,23 @@ module Fiona7
212
212
  full_text = ::YAML.load(@obj.attr_values["X_full_text"]) rescue {}
213
213
  full_text = {} unless full_text.kind_of?(Hash)
214
214
  full_text["_widget_pool"] ||= {}
215
- full_text["_widget_pool"].deep_merge!(@widget_pool)
215
+ full_text["_widget_pool"].deep_merge!(filtered_widget_pool)
216
216
  full_text.to_yaml
217
217
  rescue => e
218
218
  Rails.logger.error("Unable to store information for search engine: #{e.message}")
219
219
  nil
220
220
  end
221
221
 
222
+ def filtered_widget_pool
223
+ (@widget_pool || {}).deep_dup.tap do |filtered|
224
+ filtered.each do |k, values|
225
+ if values.kind_of?(Hash)
226
+ values.delete_if {|k, v| !(v.respond_to?(:first) && ["string", "enum", "stringlist", "text", "html", "multienum"].include?(v.first)) }
227
+ end
228
+ end
229
+ end.as_json
230
+ end
231
+
222
232
  def name_and_parent_path_from_path(path)
223
233
  components = path.split('/')
224
234
  name = components.pop.presence
@@ -4,13 +4,14 @@ require 'fiona7/tasks/task'
4
4
  module Fiona7
5
5
  module Tasks
6
6
  class Loader
7
- def initialize(user_name=nil, forbidden_classes=Fiona7::ForbiddenObjClasses.new.call)
7
+ def initialize(user_name=nil, groups=nil, forbidden_classes=Fiona7::ForbiddenObjClasses.new.call)
8
8
  self.user_name = user_name
9
+ self.groups = groups
9
10
  self.forbidden_classes = forbidden_classes
10
11
  end
11
12
 
12
13
  def call
13
- raw_tasks = RailsConnector::Task.where(self.user_login_condition).joins(
14
+ raw_tasks = self.tasks_query.joins(
14
15
  "INNER JOIN #{Fiona7::EditedObj.table_name} objs ON objs.obj_id = #{RailsConnector::Task.table_name}.obj_id"
15
16
  ).where(
16
17
  "objs.obj_class NOT IN (?)", self.forbidden_classes
@@ -41,12 +42,14 @@ module Fiona7
41
42
  end
42
43
 
43
44
  protected
44
- attr_accessor :user_name, :forbidden_classes
45
- def user_login_condition
46
- if self.user_name
47
- {user_login: self.user_name}
45
+ attr_accessor :user_name, :groups, :forbidden_classes
46
+ def tasks_query
47
+ if self.user_name.present? && self.groups.present?
48
+ RailsConnector::Task.where(
49
+ "user_login = ? OR group_name IN (?)", self.user_name, self.groups
50
+ )
48
51
  else
49
- {}
52
+ RailsConnector::Task.where(user_login: self.user_name)
50
53
  end
51
54
  end
52
55
  end
@@ -1,6 +1,9 @@
1
1
  module Fiona7
2
2
  module Tasks
3
3
  class Task < Struct.new(:id, :obj, :type, :title, :user_login, :group_name, :timestamp, :comment)
4
+ def obj_id
5
+ self.obj.try(:id)
6
+ end
4
7
  end
5
8
  end
6
9
  end
@@ -1,3 +1,3 @@
1
1
  module Fiona7
2
- VERSION = "1.5.5.4.1"
2
+ VERSION = "1.5.5.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_fiona7
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.5.4.1
4
+ version: 1.5.5.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Przedmojski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-25 00:00:00.000000000 Z
11
+ date: 2017-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails