we5-browsercms 3.0.2 → 3.0.5
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.
- data/README.markdown +1 -0
- data/app/controllers/cms/content_block_controller.rb +25 -2
- data/app/controllers/cms/content_controller.rb +31 -2
- data/app/controllers/cms/dashboard_controller.rb +2 -1
- data/app/controllers/cms/error_handling.rb +9 -2
- data/app/controllers/cms/links_controller.rb +2 -0
- data/app/controllers/cms/pages_controller.rb +22 -18
- data/app/controllers/cms/section_nodes_controller.rb +1 -1
- data/app/controllers/cms/sections_controller.rb +12 -7
- data/app/controllers/cms/sessions_controller.rb +17 -10
- data/app/controllers/cms/users_controller.rb +8 -6
- data/app/helpers/cms/application_helper.rb +2 -6
- data/app/helpers/cms/menu_helper.rb +118 -146
- data/app/helpers/cms/page_helper.rb +2 -2
- data/app/models/attachment.rb +2 -2
- data/app/models/forgot_password_mailer.rb +12 -0
- data/app/models/group.rb +13 -2
- data/app/models/guest_user.rb +9 -3
- data/app/models/link.rb +2 -2
- data/app/models/page.rb +1 -1
- data/app/models/section.rb +7 -2
- data/app/models/user.rb +35 -17
- data/app/portlets/forgot_password_portlet.rb +27 -0
- data/app/portlets/reset_password_portlet.rb +28 -0
- data/app/views/cms/blocks/_toolbar_for_member.html.erb +3 -3
- data/app/views/cms/blocks/index.html.erb +11 -6
- data/app/views/cms/content/show.html.erb +3 -3
- data/app/views/cms/forgot_password_mailer/reset_password.text.html.erb +3 -0
- data/app/views/cms/forgot_password_mailer/reset_password.text.plain.erb +3 -0
- data/app/views/cms/menus/_menu.html.erb +9 -0
- data/app/views/cms/menus/_menu_item.html.erb +11 -0
- data/app/views/cms/pages/_edit_connector.html.erb +1 -1
- data/app/views/cms/pages/_edit_container.html.erb +1 -1
- data/app/views/cms/section_nodes/_node.html.erb +1 -1
- data/app/views/cms/sections/_form.html.erb +36 -34
- data/app/views/cms/shared/access_denied.html.erb +3 -0
- data/app/views/cms/users/change_password.html.erb +8 -6
- data/app/views/cms/users/index.html.erb +1 -1
- data/app/views/cms/users/show.html.erb +50 -0
- data/app/views/layouts/_cms_toolbar.html.erb +1 -1
- data/app/views/layouts/_page_toolbar.html.erb +7 -7
- data/app/views/layouts/cms/administration.html.erb +24 -7
- data/app/views/portlets/forgot_password/_form.html.erb +5 -0
- data/app/views/portlets/forgot_password/render.html.erb +14 -0
- data/app/views/portlets/reset_password/_form.html.erb +3 -0
- data/app/views/portlets/reset_password/render.html.erb +24 -0
- data/{we5-browsercms.gemspec → browsercms.gemspec} +72 -54
- data/db/migrate/20091109175123_browsercms_3_0_5.rb +9 -0
- data/lib/acts_as_list.rb +8 -4
- data/lib/cms/acts/content_block.rb +1 -1
- data/lib/cms/authentication/controller.rb +26 -7
- data/lib/cms/behaviors/attaching.rb +3 -3
- data/lib/cms/behaviors/publishing.rb +12 -1
- data/lib/cms/behaviors/rendering.rb +17 -4
- data/lib/cms/behaviors/versioning.rb +2 -2
- data/lib/cms/routes.rb +4 -0
- data/lib/tasks/cms.rake +0 -18
- data/public/javascripts/cms/content_library.js +36 -0
- data/public/javascripts/cms/sitemap.js +21 -9
- data/public/stylesheets/cms/form_layout.css +16 -2
- data/public/stylesheets/cms/nav.css +4 -3
- data/test/functional/cms/content_block_controller_test.rb +120 -0
- data/test/functional/cms/content_controller_test.rb +135 -80
- data/test/functional/cms/links_controller_test.rb +89 -1
- data/test/functional/cms/pages_controller_test.rb +138 -0
- data/test/functional/cms/section_nodes_controller_test.rb +45 -5
- data/test/functional/cms/sections_controller_test.rb +148 -1
- data/test/functional/cms/sessions_controller_test.rb +26 -2
- data/test/functional/cms/users_controller_test.rb +49 -2
- data/test/integration/cms/password_management_test.rb +57 -0
- data/test/test_helper.rb +3 -1
- data/test/unit/behaviors/attaching_test.rb +26 -0
- data/test/unit/helpers/menu_helper_test.rb +118 -278
- data/test/unit/models/group_test.rb +6 -0
- data/test/unit/models/user_test.rb +127 -29
- metadata +20 -3
@@ -4,4 +4,10 @@ class GroupTest < ActiveSupport::TestCase
|
|
4
4
|
def test_valid
|
5
5
|
assert Factory.build(:group).valid?
|
6
6
|
end
|
7
|
+
|
8
|
+
test "Find guest group via method" do
|
9
|
+
expected = Group.find_by_code(Group::GUEST_CODE)
|
10
|
+
assert_not_nil expected, "Validates that our fixture code is loading a guest user into the database."
|
11
|
+
assert_equal expected, Group.guest
|
12
|
+
end
|
7
13
|
end
|
@@ -16,7 +16,6 @@ class UserTest < ActiveSupport::TestCase
|
|
16
16
|
@user.disable!
|
17
17
|
assert_nil User.authenticate(@user.login, @user.password)
|
18
18
|
end
|
19
|
-
|
20
19
|
def test_expiration
|
21
20
|
@user = Factory.build(:user)
|
22
21
|
assert_nil @user.expires_at
|
@@ -32,7 +31,6 @@ class UserTest < ActiveSupport::TestCase
|
|
32
31
|
@user.expires_at = 1.day.ago
|
33
32
|
assert @user.expired?
|
34
33
|
end
|
35
|
-
|
36
34
|
def test_disable_enable
|
37
35
|
@user = Factory(:user)
|
38
36
|
|
@@ -52,12 +50,29 @@ class UserTest < ActiveSupport::TestCase
|
|
52
50
|
assert !@user.expired?
|
53
51
|
assert User.active.all.include?(@user)
|
54
52
|
end
|
53
|
+
test "email validation" do
|
54
|
+
@user = Factory(:user)
|
55
|
+
assert @user.valid?
|
56
|
+
|
57
|
+
valid_emails = ['t@test.com', 'T@test.com', 'test@somewhere.mobi', 'test@somewhere.tv', 'joe_blow@somewhere.co.nz', 'joe_blow@somewhere.com.au', 't@t-t.co']
|
58
|
+
valid_emails.each do |email|
|
59
|
+
@user.email = email
|
60
|
+
assert @user.valid?
|
61
|
+
end
|
62
|
+
|
63
|
+
invalid_emails = ['', '@test.com', '@test', 'test@test', 'test@somewhere', 'test@somewhere.', 'test@somewhere.x', 'test@somewhere..']
|
64
|
+
invalid_emails.each do |email|
|
65
|
+
@user.email = email
|
66
|
+
assert !@user.valid?
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
55
70
|
end
|
56
71
|
|
57
|
-
class
|
72
|
+
class UserPermissionsTest < ActiveSupport::TestCase
|
58
73
|
def setup
|
59
74
|
@user = Factory(:user)
|
60
|
-
@guest_group = Group.
|
75
|
+
@guest_group = Group.guest
|
61
76
|
end
|
62
77
|
|
63
78
|
def test_user_permissions
|
@@ -75,36 +90,119 @@ class UserPermssionsTest < ActiveSupport::TestCase
|
|
75
90
|
assert !@user.able_to?("do something the group does not have permission to do")
|
76
91
|
end
|
77
92
|
|
78
|
-
|
93
|
+
test "cms user access to nodes" do
|
94
|
+
@group = Factory(:group, :name => "Test", :group_type => Factory(:group_type, :name => "CMS User", :cms_access => true))
|
95
|
+
@user.groups << @group
|
96
|
+
|
97
|
+
@modifiable_section = Factory(:section, :parent => root_section, :name => "Modifiable")
|
98
|
+
@non_modifiable_section = Factory(:section, :parent => root_section, :name => "Not Modifiable")
|
99
|
+
|
100
|
+
@group.sections << @modifiable_section
|
101
|
+
|
102
|
+
@modifiable_page = Factory(:page, :section => @modifiable_section)
|
103
|
+
@non_modifiable_page = Factory(:page, :section => @non_modifiable_section)
|
104
|
+
|
105
|
+
@modifiable_link = Factory(:link, :section => @modifiable_section)
|
106
|
+
@non_modifiable_link = Factory(:link, :section => @non_modifiable_section)
|
107
|
+
|
108
|
+
assert @user.able_to_modify?(@modifiable_section)
|
109
|
+
assert !@user.able_to_modify?(@non_modifiable_section)
|
110
|
+
|
111
|
+
assert @user.able_to_modify?(@modifiable_page)
|
112
|
+
assert !@user.able_to_modify?(@non_modifiable_page)
|
113
|
+
|
114
|
+
assert @user.able_to_modify?(@modifiable_link)
|
115
|
+
assert !@user.able_to_modify?(@non_modifiable_link)
|
116
|
+
end
|
117
|
+
|
118
|
+
test "cms user access to connectables" do
|
79
119
|
@group = Factory(:group, :name => "Test", :group_type => Factory(:group_type, :name => "CMS User", :cms_access => true))
|
80
|
-
@group.permissions << create_or_find_permission_named("edit_content")
|
81
|
-
@group.permissions << create_or_find_permission_named("publish_content")
|
82
120
|
@user.groups << @group
|
83
|
-
|
84
|
-
@
|
85
|
-
@
|
86
|
-
|
87
|
-
@
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
121
|
+
|
122
|
+
@modifiable_section = Factory(:section, :parent => root_section, :name => "Modifiable")
|
123
|
+
@non_modifiable_section = Factory(:section, :parent => root_section, :name => "Not Modifiable")
|
124
|
+
|
125
|
+
@group.sections << @modifiable_section
|
126
|
+
|
127
|
+
@modifiable_page = Factory(:page, :section => @modifiable_section)
|
128
|
+
@non_modifiable_page = Factory(:page, :section => @non_modifiable_section)
|
129
|
+
|
130
|
+
@all_modifiable_connectable = stub(
|
131
|
+
:class => stub(:content_block? => true, :connectable? => true),
|
132
|
+
:connected_pages => [@modifiable_page])
|
133
|
+
@some_modifiable_connectable = stub(
|
134
|
+
:class => stub(:content_block? => true, :connectable? => true),
|
135
|
+
:connected_pages => [@modifiable_page, @non_modifiable_page])
|
136
|
+
@none_modifiable_connectable = stub(
|
137
|
+
:class => stub(:content_block? => true, :connectable? => true),
|
138
|
+
:connected_pages => [@non_modifiable_page])
|
139
|
+
|
140
|
+
assert @user.able_to_modify?(@all_modifiable_connectable)
|
141
|
+
assert !@user.able_to_modify?(@some_modifiable_connectable)
|
142
|
+
assert !@user.able_to_modify?(@none_modifiable_connectable)
|
143
|
+
end
|
144
|
+
|
145
|
+
test "cms user access to non-connectable content blocks" do
|
146
|
+
@content_block = stub(:class => stub(:content_block? => true))
|
147
|
+
assert @user.able_to_modify?(@content_block)
|
93
148
|
end
|
94
149
|
|
95
|
-
|
150
|
+
test "non cms user access to nodes" do
|
96
151
|
@group = Factory(:group, :name => "Test", :group_type => Factory(:group_type, :name => "Registered User"))
|
97
152
|
@user.groups << @group
|
98
|
-
|
99
|
-
@
|
100
|
-
@
|
101
|
-
@
|
102
|
-
|
153
|
+
|
154
|
+
@modifiable_section = Factory(:section, :parent => root_section, :name => "Modifiable")
|
155
|
+
@group.sections << @modifiable_section
|
156
|
+
@non_modifiable_section = Factory(:section, :parent => root_section, :name => "Not Modifiable")
|
157
|
+
|
158
|
+
@modifiable_page = Factory(:page, :section => @modifiable_section)
|
159
|
+
@non_modifiable_page = Factory(:page, :section => @non_modifiable_section)
|
103
160
|
|
104
|
-
assert !@user.
|
105
|
-
assert !@user.
|
106
|
-
|
107
|
-
assert
|
161
|
+
assert !@user.able_to_modify?(@modifiable_section)
|
162
|
+
assert !@user.able_to_modify?(@non_modifiable_section)
|
163
|
+
|
164
|
+
assert @user.able_to_view?(@modifiable_page)
|
165
|
+
assert !@user.able_to_view?(@non_modifiable_page)
|
166
|
+
end
|
167
|
+
|
168
|
+
test "cms user with no permissions should still be able to view pages" do
|
169
|
+
@group = Factory(:group, :name => "Test", :group_type => Factory(:group_type, :name => "CMS User", :cms_access => true))
|
170
|
+
@user.groups << @group
|
171
|
+
|
172
|
+
@page = Factory(:page)
|
173
|
+
assert @user.able_to_view?(@page)
|
174
|
+
end
|
175
|
+
|
176
|
+
test "cms user who can edit content" do
|
177
|
+
@group = Factory(:group, :name => "Test", :group_type => Factory(:group_type, :name => "CMS User", :cms_access => true))
|
178
|
+
@group.permissions << create_or_find_permission_named("edit_content")
|
179
|
+
@user.groups << @group
|
180
|
+
|
181
|
+
node = stub
|
182
|
+
|
183
|
+
@user.stubs(:able_to_modify?).with(node).returns(true)
|
184
|
+
assert @user.able_to_edit?(node)
|
185
|
+
assert !@user.able_to_publish?(node)
|
186
|
+
|
187
|
+
@user.stubs(:able_to_modify?).with(node).returns(false)
|
188
|
+
assert !@user.able_to_edit?(node)
|
189
|
+
assert !@user.able_to_publish?(node)
|
190
|
+
end
|
191
|
+
|
192
|
+
test "cms user who can publish content" do
|
193
|
+
@group = Factory(:group, :name => "Test", :group_type => Factory(:group_type, :name => "CMS User", :cms_access => true))
|
194
|
+
@group.permissions << create_or_find_permission_named("publish_content")
|
195
|
+
@user.groups << @group
|
196
|
+
|
197
|
+
node = stub
|
198
|
+
|
199
|
+
@user.stubs(:able_to_modify?).with(node).returns(true)
|
200
|
+
assert !@user.able_to_edit?(node)
|
201
|
+
assert @user.able_to_publish?(node)
|
202
|
+
|
203
|
+
@user.stubs(:able_to_modify?).with(node).returns(false)
|
204
|
+
assert !@user.able_to_edit?(node)
|
205
|
+
assert !@user.able_to_publish?(node)
|
108
206
|
end
|
109
207
|
|
110
208
|
end
|
@@ -112,7 +210,7 @@ end
|
|
112
210
|
class GuestUserTest < ActiveSupport::TestCase
|
113
211
|
def setup
|
114
212
|
@user = User.guest
|
115
|
-
@guest_group = Group.
|
213
|
+
@guest_group = Group.guest
|
116
214
|
@public_page = Factory(:page, :section => root_section)
|
117
215
|
@protected_section = Factory(:section, :parent => root_section)
|
118
216
|
@protected_page = Factory(:page, :section => @protected_section)
|
@@ -127,4 +225,4 @@ class GuestUserTest < ActiveSupport::TestCase
|
|
127
225
|
assert !@user.able_to_view?(@protected_page)
|
128
226
|
end
|
129
227
|
|
130
|
-
end
|
228
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: we5-browsercms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BrowserMedia
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-19 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- app/models/email_message.rb
|
82
82
|
- app/models/email_message_mailer.rb
|
83
83
|
- app/models/file_block.rb
|
84
|
+
- app/models/forgot_password_mailer.rb
|
84
85
|
- app/models/group.rb
|
85
86
|
- app/models/group_permission.rb
|
86
87
|
- app/models/group_section.rb
|
@@ -110,7 +111,9 @@ files:
|
|
110
111
|
- app/models/user_group_membership.rb
|
111
112
|
- app/portlets/dynamic_portlet.rb
|
112
113
|
- app/portlets/email_page_portlet.rb
|
114
|
+
- app/portlets/forgot_password_portlet.rb
|
113
115
|
- app/portlets/login_portlet.rb
|
116
|
+
- app/portlets/reset_password_portlet.rb
|
114
117
|
- app/portlets/tag_cloud_portlet.rb
|
115
118
|
- app/views/cms/blocks/_hidden_fields.html.erb
|
116
119
|
- app/views/cms/blocks/_toolbar.html.erb
|
@@ -140,6 +143,8 @@ files:
|
|
140
143
|
- app/views/cms/email_messages/show.html.erb
|
141
144
|
- app/views/cms/file_blocks/_form.html.erb
|
142
145
|
- app/views/cms/file_blocks/render.html.erb
|
146
|
+
- app/views/cms/forgot_password_mailer/reset_password.text.html.erb
|
147
|
+
- app/views/cms/forgot_password_mailer/reset_password.text.plain.erb
|
143
148
|
- app/views/cms/form_builder/_cms_date_picker.html.erb
|
144
149
|
- app/views/cms/form_builder/_cms_datetime_select.html.erb
|
145
150
|
- app/views/cms/form_builder/_cms_drop_down.html.erb
|
@@ -162,6 +167,8 @@ files:
|
|
162
167
|
- app/views/cms/links/destroy.js.rjs
|
163
168
|
- app/views/cms/links/edit.html.erb
|
164
169
|
- app/views/cms/links/new.html.erb
|
170
|
+
- app/views/cms/menus/_menu.html.erb
|
171
|
+
- app/views/cms/menus/_menu_item.html.erb
|
165
172
|
- app/views/cms/page_routes/_form.html.erb
|
166
173
|
- app/views/cms/page_routes/edit.html.erb
|
167
174
|
- app/views/cms/page_routes/index.html.erb
|
@@ -198,6 +205,7 @@ files:
|
|
198
205
|
- app/views/cms/shared/_pagination.html.erb
|
199
206
|
- app/views/cms/shared/_version_conflict_diff.html.erb
|
200
207
|
- app/views/cms/shared/_version_conflict_error.html.erb
|
208
|
+
- app/views/cms/shared/access_denied.html.erb
|
201
209
|
- app/views/cms/shared/error.html.erb
|
202
210
|
- app/views/cms/tags/_form.html.erb
|
203
211
|
- app/views/cms/tags/render.html.erb
|
@@ -212,6 +220,7 @@ files:
|
|
212
220
|
- app/views/cms/users/edit.html.erb
|
213
221
|
- app/views/cms/users/index.html.erb
|
214
222
|
- app/views/cms/users/new.html.erb
|
223
|
+
- app/views/cms/users/show.html.erb
|
215
224
|
- app/views/layouts/_cms_toolbar.html.erb
|
216
225
|
- app/views/layouts/_page_toolbar.html.erb
|
217
226
|
- app/views/layouts/application.html.erb
|
@@ -228,11 +237,16 @@ files:
|
|
228
237
|
- app/views/portlets/dynamic/_form.html.erb
|
229
238
|
- app/views/portlets/email_page/_form.html.erb
|
230
239
|
- app/views/portlets/email_page/render.html.erb
|
240
|
+
- app/views/portlets/forgot_password/_form.html.erb
|
241
|
+
- app/views/portlets/forgot_password/render.html.erb
|
231
242
|
- app/views/portlets/login/_form.html.erb
|
232
243
|
- app/views/portlets/login/render.html.erb
|
233
244
|
- app/views/portlets/portlets/_form.html.erb
|
245
|
+
- app/views/portlets/reset_password/_form.html.erb
|
246
|
+
- app/views/portlets/reset_password/render.html.erb
|
234
247
|
- app/views/portlets/tag_cloud/_form.html.erb
|
235
248
|
- app/views/portlets/tag_cloud/render.html.erb
|
249
|
+
- browsercms.gemspec
|
236
250
|
- db/demo/data.rb
|
237
251
|
- db/demo/page_partials/_footer.html.erb
|
238
252
|
- db/demo/page_partials/_header.html.erb
|
@@ -240,6 +254,7 @@ files:
|
|
240
254
|
- db/demo/page_templates/sub_page.html.erb
|
241
255
|
- db/migrate/20080815014337_browsercms_3_0_0.rb
|
242
256
|
- db/migrate/20081114172307_load_seed_data.rb
|
257
|
+
- db/migrate/20091109175123_browsercms_3_0_5.rb
|
243
258
|
- doc/app/classes/AbstractFileBlock.html
|
244
259
|
- doc/app/classes/ActiveRecord.html
|
245
260
|
- doc/app/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html
|
@@ -1174,6 +1189,7 @@ files:
|
|
1174
1189
|
- public/images/cms/usercontrols_bg.png
|
1175
1190
|
- public/images/cms/usercontrols_bg_cap.png
|
1176
1191
|
- public/javascripts/cms/application.js
|
1192
|
+
- public/javascripts/cms/content_library.js
|
1177
1193
|
- public/javascripts/cms/editor.js
|
1178
1194
|
- public/javascripts/cms/sitemap.js
|
1179
1195
|
- public/javascripts/jquery-ui.js
|
@@ -1233,7 +1249,6 @@ files:
|
|
1233
1249
|
- templates/blank.rb
|
1234
1250
|
- templates/demo.rb
|
1235
1251
|
- templates/module.rb
|
1236
|
-
- we5-browsercms.gemspec
|
1237
1252
|
- LICENSE.txt
|
1238
1253
|
- README.markdown
|
1239
1254
|
has_rdoc: true
|
@@ -1270,6 +1285,7 @@ test_files:
|
|
1270
1285
|
- test/functional/cms/cache_controller_test.rb
|
1271
1286
|
- test/functional/cms/categories_controller_test.rb
|
1272
1287
|
- test/functional/cms/connectors_controller_test.rb
|
1288
|
+
- test/functional/cms/content_block_controller_test.rb
|
1273
1289
|
- test/functional/cms/content_controller_test.rb
|
1274
1290
|
- test/functional/cms/content_types_controller_test.rb
|
1275
1291
|
- test/functional/cms/dashboard_controller_test.rb
|
@@ -1287,6 +1303,7 @@ test_files:
|
|
1287
1303
|
- test/functional/cms/sessions_controller_test.rb
|
1288
1304
|
- test/functional/cms/toolbar_controller_test.rb
|
1289
1305
|
- test/functional/cms/users_controller_test.rb
|
1306
|
+
- test/integration/cms/password_management_test.rb
|
1290
1307
|
- test/integration/login_test.rb
|
1291
1308
|
- test/test_helper.rb
|
1292
1309
|
- test/test_logging.rb
|