caboose-cms 0.7.60 → 0.7.61

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: 5ad4bf6009e7d52ac46a3190b3c4889d0e89c076
4
- data.tar.gz: cf31d15f32e0ead99aff9cff064c3d29bf80bceb
3
+ metadata.gz: 1dd0c8df55ed44f2cf96ae3a6bcf5f0880bcf0e1
4
+ data.tar.gz: 5e9eefed13aadc1df28ad230b9a76477140a0b46
5
5
  SHA512:
6
- metadata.gz: d75db978103fa75b118f2aafe0e110745efd5a98dfeea8c494d51a751b47f76c83ebe2c5ae029437df9bc5f8cb88b3e1201669c02d75ac6cd04b7409840d975c
7
- data.tar.gz: 193149455efe7ea7982c3a19f25e03c3e3a8e9c94570a3cb11a6f60c5c4a341ce81209578353d5182aaaf2f2b0ef86125959b3046f59ec3d5e793c98133350d8
6
+ metadata.gz: 8be4e56bcd72b88986b62097994deab1036f395080a264de958c30846918520b2ceb53fec6054908ef663a76ebb4bc840cd9e59f533c609a0fbfe0d029f6b776
7
+ data.tar.gz: 485e9fdc38ad15974a12bba7ce5bbe7859365d1793a653240282b466477ad005fe2e13b6b5c815ddc088b81b10f99f292799543acf0f9cac2ee92579fbd0b59a
@@ -3,7 +3,7 @@ module Caboose
3
3
  class AdminController < ApplicationController
4
4
 
5
5
  # @route GET /admin
6
- def index
6
+ def index
7
7
  return if !user_is_allowed('admin', 'view')
8
8
  #if logged_in?
9
9
  # redirect_to '/admin/pages'
@@ -16,16 +16,19 @@ module Caboose
16
16
  @use_page_cache = !request.fullpath.starts_with?('/admin')
17
17
 
18
18
  # Get the site we're working with
19
- @domain = Domain.where(:domain => request.host_with_port).first
20
- @site = @domain ? @domain.site : nil
19
+ @domain = Domain.where(:domain => request.host_with_port).first
20
+ @site = @domain ? @domain.site : nil
21
+ if @domain.nil? || @site.nil?
22
+ Caboose.log("Error: No site configured for #{request.host_with_port}")
23
+ end
21
24
 
22
25
  # Set the site in any mailers
23
26
  CabooseMailer.site = @site
24
27
 
25
28
  # Make sure someone is logged in
26
- if !logged_in?
27
- elo = User.find(User::LOGGED_OUT_USER_ID)
28
- login_user(elo)
29
+ if !logged_in? && @site
30
+ elo = User.logged_out_user(@site.id)
31
+ login_user(elo) if elo
29
32
  end
30
33
 
31
34
  session['use_redirect_urls'] = true if session['use_redirect_urls'].nil?
@@ -138,8 +141,8 @@ module Caboose
138
141
  # Returns whether or not a user is logged in
139
142
  def logged_in?
140
143
  validate_token
141
- validate_cookie
142
- return true if !session["app_user"].nil? && session["app_user"] != false && session["app_user"].id != -1 && session["app_user"].id != User::LOGGED_OUT_USER_ID
144
+ validate_cookie
145
+ return true if !session["app_user"].nil? && session["app_user"] != false && session["app_user"].id != -1 && session["app_user"].id != User.logged_out_user_id(@site.id)
143
146
  return false
144
147
  end
145
148
 
@@ -157,11 +160,13 @@ module Caboose
157
160
  end
158
161
 
159
162
  # Checks to see if a remember me cookie value is present.
160
- def validate_cookie
161
- if cookies[:caboose_user_id] && User.exists?(cookies[:caboose_user_id])
162
- user = User.find(cookies[:caboose_user_id])
163
- login_user(user)
164
- return true
163
+ def validate_cookie
164
+ if cookies[:caboose_user_id]
165
+ user = User.where(:id => cookies[:caboose_user_id]).first
166
+ if user
167
+ login_user(user)
168
+ return true
169
+ end
165
170
  end
166
171
  return false
167
172
  end
@@ -5,7 +5,7 @@ module Caboose
5
5
  Caboose.plugin_hook('before_logout')
6
6
 
7
7
  logout_user
8
- elo = User.find(User::LOGGED_OUT_USER_ID)
8
+ elo = User.logged_out_user(@site.id)
9
9
  login_user(elo)
10
10
  redirect_to params[:return_url] ? params[:return_url] : "/"
11
11
  end
@@ -117,6 +117,7 @@ class Caboose::Block < ActiveRecord::Base
117
117
  end
118
118
 
119
119
  def render(block, options)
120
+ #Caboose.log("block.full_name = #{block.full_name}")
120
121
  #Caboose.log("block.render\nself.id = #{self.id}\nblock = #{block}\nblock.full_name = #{block.full_name}\noptions.class = #{options.class}\noptions = #{options}")
121
122
  if block && block.is_a?(String)
122
123
  #Caboose.log("Block #{block} is a string, finding block object... self.id = #{self.id}")
@@ -232,7 +233,7 @@ class Caboose::Block < ActiveRecord::Base
232
233
  "../../app/views/caboose/blocks/#{block.block_type.field_type}",
233
234
  "caboose/blocks/#{full_name}",
234
235
  "caboose/blocks/#{block.block_type.name}",
235
- "caboose/blocks/#{block.block_type.field_type}"
236
+ "caboose/blocks/#{block.block_type.field_type}"
236
237
  ]
237
238
  #Caboose.log(arr)
238
239
  str = self.render_helper(view, options2, block, full_name, arr, 0)
@@ -246,7 +247,7 @@ class Caboose::Block < ActiveRecord::Base
246
247
  begin
247
248
  str = view.render(:partial => arr[i], :locals => options)
248
249
  #Caboose.log("Level #{i+1} for #{full_name}: Found partial #{arr[i]}")
249
- rescue ActionView::MissingTemplate => ex
250
+ rescue ActionView::MissingTemplate => ex
250
251
  #Caboose.log("Level #{i+1} for #{full_name}: #{ex.message}")
251
252
  str = render_helper(view, options, block, full_name, arr, i+1)
252
253
  rescue Exception => ex
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.7.60'
2
+ VERSION = '0.7.61'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.60
4
+ version: 0.7.61
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-11 00:00:00.000000000 Z
11
+ date: 2016-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg