caboose-cms 0.9.169 → 0.9.170
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/caboose/theme.rb +5 -5
- data/app/models/caboose/user.rb +29 -14
- data/lib/caboose/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c121572fe7fa94e41fa2e83034b8751b09db5780
|
4
|
+
data.tar.gz: cda1f7ab16cf092667cd648cd3687f91deef4033
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4827e40c82dd96eb8741960722451a2904f3c0e13961f375b73eccb0a85192f870e31e7b6a94f4fed85ffd0cabda6ccff216db9e279fa203e34e851f96bf353
|
7
|
+
data.tar.gz: 4c7b333e238e5ac3d1df26f6217ff5398b2c8fb36b2a1f51dce38b6f33e26eea2eaf44baaa6be6978af850a5312386901c11e7862490400f5502513cdd8bafd2
|
data/app/models/caboose/theme.rb
CHANGED
@@ -73,6 +73,7 @@ class Caboose::Theme < ActiveRecord::Base
|
|
73
73
|
:digest
|
74
74
|
|
75
75
|
def compile(for_site_id = 0)
|
76
|
+
Caboose.log("compiling theme for site #{for_site_id}")
|
76
77
|
theme = self
|
77
78
|
theme_name = 'default'
|
78
79
|
path = Rails.root.join('themes', "#{theme_name}.scss.erb")
|
@@ -81,7 +82,7 @@ class Caboose::Theme < ActiveRecord::Base
|
|
81
82
|
tmp_asset_name = "theme_#{self.id}_site_#{for_site_id}"
|
82
83
|
FileUtils.mkdir_p(tmp_themes_path) unless File.directory?(tmp_themes_path)
|
83
84
|
File.open(File.join(tmp_themes_path, "#{tmp_asset_name}.scss"), 'w') { |f| f.write(body) }
|
84
|
-
begin
|
85
|
+
# begin
|
85
86
|
env = if Rails.application.assets.is_a?(Sprockets::Index)
|
86
87
|
Rails.application.assets.instance_variable_get('@environment')
|
87
88
|
else
|
@@ -101,15 +102,14 @@ class Caboose::Theme < ActiveRecord::Base
|
|
101
102
|
bucket = AWS::S3.new.buckets[config['bucket']]
|
102
103
|
bucket.objects[theme.asset_path(asset.digest, for_site_id)].write(str, :acl => 'public-read', :content_type => 'text/css')
|
103
104
|
else
|
104
|
-
Caboose.log("creating themes folder if doesn't exist")
|
105
105
|
theme_path = File.join(Rails.root, 'public', 'assets', 'themes')
|
106
106
|
FileUtils.mkdir_p(theme_path) unless File.directory?(theme_path)
|
107
107
|
File.open(File.join(Rails.root, 'public', theme.asset_path(asset.digest, for_site_id)), 'w') { |f| f.write(compressed_body) }
|
108
108
|
end
|
109
109
|
self.update_digest(asset.digest)
|
110
|
-
|
111
|
-
|
112
|
-
|
110
|
+
# rescue Sass::SyntaxError => error
|
111
|
+
# theme.revert
|
112
|
+
# end
|
113
113
|
end
|
114
114
|
|
115
115
|
def revert
|
data/app/models/caboose/user.rb
CHANGED
@@ -49,25 +49,40 @@ class Caboose::User < ActiveRecord::Base
|
|
49
49
|
def forem_email
|
50
50
|
self.email
|
51
51
|
end
|
52
|
-
|
53
|
-
def is_allowed(resource, action)
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
if role.is_allowed(resource, action)
|
64
|
-
return true
|
65
|
-
end
|
52
|
+
|
53
|
+
def is_allowed(resource, action)
|
54
|
+
elo = Caboose::Role.logged_out_role(self.site_id)
|
55
|
+
elo_is_allowed = elo.is_allowed(resource, action)
|
56
|
+
return true if elo_is_allowed
|
57
|
+
return false if !elo_is_allowed && self.is_logged_out_user?
|
58
|
+
eli = Caboose::Role.logged_in_role(self.site_id)
|
59
|
+
return true if self.id != elo.id && eli.is_allowed(resource, action)
|
60
|
+
for role in roles
|
61
|
+
if role.is_allowed(resource, action)
|
62
|
+
return true
|
66
63
|
end
|
67
64
|
end
|
68
65
|
return false
|
69
66
|
end
|
70
67
|
|
68
|
+
# def is_allowed(resource, action)
|
69
|
+
# if self.username == 'elo'
|
70
|
+
# elo = Caboose::Role.logged_out_role(self.site_id)
|
71
|
+
# elo_is_allowed = elo.is_allowed(resource, action)
|
72
|
+
# return true if elo_is_allowed
|
73
|
+
# return false if !elo_is_allowed && self.is_logged_out_user?
|
74
|
+
# eli = Caboose::Role.logged_in_role(self.site_id)
|
75
|
+
# return true if self.id != elo.id && eli.is_allowed(resource, action)
|
76
|
+
# else
|
77
|
+
# for role in roles
|
78
|
+
# if role.is_allowed(resource, action)
|
79
|
+
# return true
|
80
|
+
# end
|
81
|
+
# end
|
82
|
+
# end
|
83
|
+
# return false
|
84
|
+
# end
|
85
|
+
|
71
86
|
def self.validate_token(token)
|
72
87
|
user = self.where('token' => token).first
|
73
88
|
return user
|
data/lib/caboose/version.rb
CHANGED