infopark_rails_connector 6.8.1.26.236500544 → 6.8.2.7.128454143

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,8 +11,7 @@ module RailsConnector
11
11
  def rails_connector_header_tags
12
12
  html = "".html_safe
13
13
  html += tag('meta', :name => 'generator',
14
- :content => "Rails Connector for Infopark CMS Fiona by Infopark AG (www.infopark.de); "\
15
- "Version #{Gem.loaded_specs['infopark_rails_connector'].version}")
14
+ :content => "Rails Connector for Infopark CMS Fiona by Infopark AG (www.infopark.de)")
16
15
  if Configuration.enabled?(:rss)
17
16
  html += auto_discovery_link_tag(:rss, rss_url, :title => 'RSS Feed')
18
17
  end
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  ## /Network/Servers/xs2.infopark/Users/develop/dcc/tmp/Rails_Connector_95/repos/rails_connector/config/ca-bundle.crt -- Bundle of CA Root Certificates
3
3
  ##
4
- ## Converted at: Fri Jan 25 10:08:18 2013 UTC
4
+ ## Converted at: Wed Jan 30 10:16:42 2013 UTC
5
5
  ##
6
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
@@ -12,7 +12,7 @@ module RailsConnector
12
12
  def install_configuration
13
13
  copy_file "initializers/rails_connector.rb", "config/initializers/rails_connector.rb"
14
14
  copy_file 'initializers/crm_connector.rb', 'config/initializers/crm_connector.rb'
15
- copy_file "obj_extensions.rb", "lib/obj_extensions.rb"
15
+ template 'app/models/obj.rb.erb', 'app/models/obj.rb'
16
16
  copy_file "local/configuration.rb", "config/local/configuration.rb"
17
17
  end
18
18
 
@@ -0,0 +1,5 @@
1
+ # This is the base class for accessing CMS objects.
2
+ # See the documentation for details: http://rubydoc.info/gems/infopark_<%= RailsConnector.platform %>_connector/RailsConnector/BasicObj
3
+ class Obj < RailsConnector::BasicObj
4
+ # Your custom code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ # empty implementation for Obj
2
+ # only unsed in case the app does not define Obj itself
3
+ ::Obj = Class.new(RailsConnector::BasicObj)
@@ -9,13 +9,13 @@ module RailsConnector
9
9
  end
10
10
 
11
11
  # Returns +true+ by default.
12
- # Implement your own conditions by overwriting this method in your {ObjExtensions}.
12
+ # Implement your own conditions by overwriting this method in your {Obj}.
13
13
  def allow_comments?
14
14
  true
15
15
  end
16
16
 
17
17
  # Returns +true+ by default.
18
- # Implement your own conditions by overwriting this method in your {ObjExtensions}.
18
+ # Implement your own conditions by overwriting this method in your {Obj}.
19
19
  def allow_anonymous_comments?
20
20
  true
21
21
  end
@@ -62,6 +62,27 @@ module RailsConnector
62
62
  # @api public
63
63
  attr_reader :content_service
64
64
 
65
+ # Determine if current visitor is permitted to edit content.
66
+ attr_accessor :editing_auth_callback
67
+
68
+ # Configure a callback to be invoked when the rails connector determines,
69
+ # if current visitor is permitted to edit content.
70
+ # Default is <code>false</code>.
71
+ #
72
+ # Example Usage:
73
+ # RailsConnector::Configuation.editing_auth do |env|
74
+ # request = Rack::Request.new(env)
75
+ # # return truey if current visitor is permitted to edit content, falsy otherwise
76
+ # end
77
+ # @api public
78
+ def editing_auth(&block)
79
+ if block.respond_to?(:arity) && block.arity == 1
80
+ self.editing_auth_callback = block
81
+ else
82
+ raise ArgumentError, 'editing_auth is not callable with arity one!'
83
+ end
84
+ end
85
+
65
86
  # Gets path of a CA certification file in PEM format.
66
87
  # @api public
67
88
  attr_reader :ca_file
@@ -170,7 +191,7 @@ module RailsConnector
170
191
  enable_authentication
171
192
  # Hier muss explizit der Namespace verwendet werden, da diese Methode von Rails
172
193
  # während der Initialisierung aufgerufen wird.
173
- ::RailsConnector::Obj.configure_for_content(
194
+ ::RailsConnector::BasicObj.configure_for_content(
174
195
  ::RailsConnector::Configuration.use_edited_content? ? :edited : :released
175
196
  )
176
197
  end
@@ -179,7 +200,7 @@ module RailsConnector
179
200
  unless Rails.configuration.cache_classes
180
201
  after_initialize
181
202
  NamedLink.reset_cache
182
- Obj.reset_type_cache
203
+ BasicObj.reset_type_cache
183
204
  initialize_addon_mixins
184
205
  end
185
206
  end
@@ -239,9 +260,9 @@ module RailsConnector
239
260
  RailsConnector::SES.enable
240
261
  end
241
262
  RailsConnector::Crm.enable if enabled?(:crm)
242
- ::Obj.__send__(:include, RailsConnector::Syndicateable) if enabled?(:rss)
243
- ::Obj.__send__(:include, RailsConnector::Commentable) if enabled?(:comments)
244
- ::Obj.__send__(:include, RailsConnector::Rateable) if enabled?(:ratings)
263
+ RailsConnector::BasicObj.__send__(:include, RailsConnector::Syndicateable) if enabled?(:rss)
264
+ RailsConnector::BasicObj.__send__(:include, RailsConnector::Commentable) if enabled?(:comments)
265
+ RailsConnector::BasicObj.__send__(:include, RailsConnector::Rateable) if enabled?(:ratings)
245
266
  end
246
267
 
247
268
  def local_config_file
@@ -309,6 +330,7 @@ module RailsConnector
309
330
  self.cache_editable_workspaces = false
310
331
  self.use_recaptcha_on_user_registration = true
311
332
  self.ca_file = DEFAULT_CA_FILE
333
+ self.editing_auth{ |env| false }
312
334
 
313
335
  register_features(
314
336
  :search, :time_machine, :rss, :comments, :ratings,
@@ -71,6 +71,13 @@ module RailsConnector
71
71
  # @api public
72
72
  def current_user
73
73
  @current_user ||= if logged_in?
74
+ incorrect_encoding = session[:user].any? do |key, value|
75
+ value.is_a?(String) && value.encoding_aware? && value.encoding.name != 'UTF-8'
76
+ end
77
+ if incorrect_encoding
78
+ self.current_user = Infopark::Crm::Contact.find(session[:user][:id])
79
+ end
80
+
74
81
  user_session = session[:user].dup
75
82
  live_server_groups = user_session.delete(:live_server_groups)
76
83
  user = Infopark::Crm::Contact.new(user_session || {})
@@ -59,13 +59,6 @@ module ::RailsConnector
59
59
  ActionView::Base.__send__(:include, CmsRoutingHelper)
60
60
  end
61
61
 
62
- initializer "rails_connector.enable_obj_extensions", :after => "load_config_initializers" do
63
- # ObjExtensions are enabled automatically when the top-level constant Obj is loaded.
64
- # This initializer only ensures, that ObjExtensions are loaded at least once on bootup.
65
- # They may have been loaded already (implicitely) at the load_config_initializers stage.
66
- ::Obj
67
- end
68
-
69
62
  initializer "rails_connector.config_local", :after => :load_config_initializers,
70
63
  :before => :engines_blank_point do
71
64
  Dir.glob(Rails.root.join('config', 'local', '*.rb')).each do |file|
@@ -8,7 +8,7 @@ module RailsConnector
8
8
  module ClassMethods
9
9
  # Finds all objects that shall be included in the SEO <tt>sitemap.xml</tt>.
10
10
  # On each exportable none-image object, {InstanceMethods#included_in_seo_sitemap?} is called.
11
- # Overwrite <tt>included_in_seo_sitemap?</tt> in your {ObjExtensions} to adjust the criteria.
11
+ # Overwrite <tt>included_in_seo_sitemap?</tt> in your {Obj} to adjust the criteria.
12
12
  # @api public
13
13
  def find_all_for_sitemap
14
14
  start = Obj.homepage
@@ -23,27 +23,27 @@ module RailsConnector
23
23
  # @api public
24
24
  module InstanceMethods
25
25
 
26
- # Returns +true+ by default. Overwrite in your {ObjExtensions} as you like.
26
+ # Returns +true+ by default. Overwrite in your {Obj} as you like.
27
27
  # @api public
28
28
  def readable_for_googlebots?
29
29
  true
30
30
  end
31
31
 
32
32
  # Default implementation: objects have to be <tt>active?</tt> and at least of one of: permitted for anyone (<tt>permitted_groups = []</tt>), <tt>readable_for_googlebots?</tt>.
33
- # Overwrite in your {ObjExtensions} as you like.
33
+ # Overwrite in your {Obj} as you like.
34
34
  # @api public
35
35
  def included_in_seo_sitemap?
36
36
  (permitted_groups.empty? || readable_for_googlebots?) && active?
37
37
  end
38
38
 
39
39
  # Returns an html-stripped <tt>Obj#body</tt>, truncated to 300 chars.
40
- # Overwrite in your {ObjExtensions} as you like. For example, point to a CMS field.
40
+ # Overwrite in your {Obj} as you like. For example, point to a CMS field.
41
41
  # @api public
42
42
  def seo_description
43
43
  HTML::FullSanitizer.new.sanitize(body.strip.gsub(%r{[\n|\r]}, " ")).mb_chars[0,300] if body
44
44
  end
45
45
 
46
- # Returns +nil+ by default. Overwrite in your {ObjExtensions} as you like.
46
+ # Returns +nil+ by default. Overwrite in your {Obj} as you like.
47
47
  # For example, point to a CMS field of your objects.
48
48
  # @api public
49
49
  def seo_keywords
@@ -4,7 +4,7 @@ module RailsConnector
4
4
  # RailsConnector::Configuration.enable(:rss)
5
5
  # @api public
6
6
  module Syndicateable
7
- # Overwrite this method in your {ObjExtensions} in order to display another field in your feed.
7
+ # Overwrite this method in your {Obj} in order to display another field in your feed.
8
8
  # @api public
9
9
  def rss_description
10
10
  body
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_rails_connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.8.1.26.236500544
4
+ version: 6.8.2.7.128454143
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-25 00:00:00.000000000 Z
12
+ date: 2013-01-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -253,7 +253,6 @@ files:
253
253
  - app/mailers/confirmation_mailer.rb
254
254
  - app/models/crm_form.rb
255
255
  - app/models/named_link.rb
256
- - app/models/obj.rb
257
256
  - app/models/rails_connector/default_comment.rb
258
257
  - app/models/rails_connector/default_rating.rb
259
258
  - app/models/rails_connector/link_list.rb
@@ -309,14 +308,14 @@ files:
309
308
  - lib/generators/rails_connector/comments/comments_generator.rb
310
309
  - lib/generators/rails_connector/comments/templates/migration.rb
311
310
  - lib/generators/rails_connector/install/install_generator.rb
311
+ - lib/generators/rails_connector/install/templates/app/models/obj.rb.erb
312
312
  - lib/generators/rails_connector/install/templates/initializers/crm_connector.rb
313
313
  - lib/generators/rails_connector/install/templates/initializers/rails_connector.rb
314
314
  - lib/generators/rails_connector/install/templates/local/configuration.rb
315
- - lib/generators/rails_connector/install/templates/obj_extensions.rb
316
315
  - lib/generators/rails_connector/ratings/ratings_generator.rb
317
316
  - lib/generators/rails_connector/ratings/templates/migration.rb
318
317
  - lib/infopark_rails_connector.rb
319
- - lib/obj_extensions.rb
318
+ - lib/obj.rb
320
319
  - lib/rails_connector/authenticable.rb
321
320
  - lib/rails_connector/cms_accessible.rb
322
321
  - lib/rails_connector/cms_dispatch_controller.rb
@@ -364,7 +363,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
364
363
  version: '0'
365
364
  segments:
366
365
  - 0
367
- hash: -1041378993
366
+ hash: 688003405
368
367
  required_rubygems_version: !ruby/object:Gem::Requirement
369
368
  none: false
370
369
  requirements:
@@ -1,9 +0,0 @@
1
- # ::Obj is just a shortcut
2
- ::Obj = ::RailsConnector::Obj
3
-
4
- # load ObjExtensions from the embedding Rails App.
5
- # Must be done after Obj has been defined.
6
- require "obj_extensions"
7
- if (ObjExtensions rescue nil)
8
- ObjExtensions.enable
9
- end
@@ -1,26 +0,0 @@
1
- # @api public
2
- module ObjExtensions
3
-
4
- # Infopark Rails Connector enables the developer to define specific behavior for Fiona CMS
5
- # classes by using Single Table Inheritance (http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html).
6
- #
7
- # If you wish to decorate the Obj model with extra behavior, you will need to add it here.
8
- #
9
- # Be careful only to use methods and classes that are part of the documented api.
10
- # Other methods and classes may change without warning.
11
- # @api public
12
- def self.enable
13
- return if Obj.respond_to? :obj_extensions_enabled
14
-
15
- Obj.class_eval do
16
-
17
- def self.obj_extensions_enabled
18
- end
19
-
20
- # Add custom extensions to the Obj model below
21
- #
22
-
23
- end
24
-
25
- end
26
- end
@@ -1,6 +0,0 @@
1
- # empty implementation for ObjExtension
2
- # only unsed in case the app does not define ObjExtensions itself
3
- module ObjExtensions
4
- def self.enable
5
- end
6
- end