govuk_content_models 24.0.1 → 24.1.0
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 24.1.0
|
2
|
+
|
3
|
+
* Use version numbers for picking current edition in 'Edition.find_and_identify'
|
4
|
+
* Changed to depend on the latest major release of gds-sso [10.0.0]
|
5
|
+
which requires a `disabled` field to be defined on the `User` model.
|
6
|
+
This field mirrors the user state in Signon.
|
7
|
+
|
1
8
|
## 24.0.1
|
2
9
|
|
3
10
|
* Corrected the request_type recorded in actions for a create_edition
|
data/app/models/edition.rb
CHANGED
data/app/models/user.rb
CHANGED
@@ -21,7 +21,10 @@ class User
|
|
21
21
|
field "permissions", type: Array
|
22
22
|
field "remotely_signed_out", type: Boolean, default: false
|
23
23
|
field "organisation_slug", type: String
|
24
|
-
|
24
|
+
field "disabled", type: Boolean, default: false
|
25
|
+
|
26
|
+
index "disabled"
|
27
|
+
|
25
28
|
GOVSPEAK_FIELDS = []
|
26
29
|
|
27
30
|
# Setup accessible (or protected) attributes for your model
|
@@ -29,6 +32,8 @@ class User
|
|
29
32
|
attr_accessible :email, :name, :uid, :permissions, as: :oauth
|
30
33
|
|
31
34
|
scope :alphabetized, order_by(name: :asc)
|
35
|
+
scope :enabled, any_of({ :disabled.exists => false },
|
36
|
+
{ :disabled.in => [false, nil] })
|
32
37
|
|
33
38
|
validates_with SafeHtml
|
34
39
|
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_dependency "bson_ext"
|
19
19
|
gem.add_dependency "gds-api-adapters", ">= 10.9.0"
|
20
20
|
|
21
|
-
gem.add_dependency "gds-sso", ">=
|
21
|
+
gem.add_dependency "gds-sso", ">= 10.0.0"
|
22
22
|
gem.add_dependency "govspeak", "~> 3.1.0"
|
23
23
|
# Mongoid 2.5.0 supports the newer 1.7.x and 1.8.x Mongo drivers
|
24
24
|
gem.add_dependency "mongoid", "~> 2.5"
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |gem|
|
|
29
29
|
gem.add_development_dependency "factory_girl", "3.3.0"
|
30
30
|
gem.add_development_dependency "gem_publisher", "1.2.0"
|
31
31
|
gem.add_development_dependency "mocha", "0.13.3"
|
32
|
-
gem.add_development_dependency "multi_json"
|
32
|
+
gem.add_development_dependency "multi_json"
|
33
33
|
gem.add_development_dependency "rake", "0.9.2.2"
|
34
34
|
gem.add_development_dependency "webmock", "1.8.7"
|
35
35
|
gem.add_development_dependency "shoulda-context", "1.0.0"
|
data/test/models/user_test.rb
CHANGED
@@ -20,6 +20,17 @@ class UserTest < ActiveSupport::TestCase
|
|
20
20
|
assert_equal "", user.to_s
|
21
21
|
end
|
22
22
|
|
23
|
+
test "should return enabled users" do
|
24
|
+
disabled = FactoryGirl.create(:user, disabled: true)
|
25
|
+
|
26
|
+
FactoryGirl.create(:user).unset(:disabled)
|
27
|
+
FactoryGirl.create(:user, disabled: false)
|
28
|
+
FactoryGirl.create(:user, disabled: nil)
|
29
|
+
|
30
|
+
assert_equal 3, User.enabled.count
|
31
|
+
refute User.enabled.include? disabled
|
32
|
+
end
|
33
|
+
|
23
34
|
test "should create new user with oauth params" do
|
24
35
|
auth_hash = {
|
25
36
|
"uid" => "1234abcd",
|
@@ -30,7 +41,8 @@ class UserTest < ActiveSupport::TestCase
|
|
30
41
|
},
|
31
42
|
"extra" => {
|
32
43
|
"user" => {
|
33
|
-
"permissions" => ["signin"]
|
44
|
+
"permissions" => ["signin"],
|
45
|
+
"disabled" => false,
|
34
46
|
}
|
35
47
|
}
|
36
48
|
}
|
@@ -39,6 +51,7 @@ class UserTest < ActiveSupport::TestCase
|
|
39
51
|
assert_equal "user@example.com", user.email
|
40
52
|
assert_equal "Luther Blisset", user.name
|
41
53
|
assert_equal(["signin"], user.permissions)
|
54
|
+
refute user.disabled?
|
42
55
|
end
|
43
56
|
|
44
57
|
test "should find and update the user with oauth params" do
|
@@ -53,7 +66,8 @@ class UserTest < ActiveSupport::TestCase
|
|
53
66
|
},
|
54
67
|
"extra" => {
|
55
68
|
"user" => {
|
56
|
-
"permissions" => []
|
69
|
+
"permissions" => [],
|
70
|
+
"disabled" => true
|
57
71
|
}
|
58
72
|
}
|
59
73
|
}
|
@@ -62,6 +76,7 @@ class UserTest < ActiveSupport::TestCase
|
|
62
76
|
assert_equal "new@m.com", user.email
|
63
77
|
assert_equal "New", user.name
|
64
78
|
assert_equal([], user.permissions)
|
79
|
+
assert user.disabled?
|
65
80
|
end
|
66
81
|
|
67
82
|
test "should create insecure gravatar URL" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_content_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 24.0
|
4
|
+
version: 24.1.0
|
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: 2014-11-
|
12
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bson_ext
|
@@ -49,9 +49,6 @@ dependencies:
|
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
51
|
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 7.0.0
|
54
|
-
- - <
|
55
52
|
- !ruby/object:Gem::Version
|
56
53
|
version: 10.0.0
|
57
54
|
type: :runtime
|
@@ -60,9 +57,6 @@ dependencies:
|
|
60
57
|
none: false
|
61
58
|
requirements:
|
62
59
|
- - ! '>='
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: 7.0.0
|
65
|
-
- - <
|
66
60
|
- !ruby/object:Gem::Version
|
67
61
|
version: 10.0.0
|
68
62
|
- !ruby/object:Gem::Dependency
|
@@ -198,17 +192,17 @@ dependencies:
|
|
198
192
|
requirement: !ruby/object:Gem::Requirement
|
199
193
|
none: false
|
200
194
|
requirements:
|
201
|
-
- - '
|
195
|
+
- - ! '>='
|
202
196
|
- !ruby/object:Gem::Version
|
203
|
-
version:
|
197
|
+
version: '0'
|
204
198
|
type: :development
|
205
199
|
prerelease: false
|
206
200
|
version_requirements: !ruby/object:Gem::Requirement
|
207
201
|
none: false
|
208
202
|
requirements:
|
209
|
-
- - '
|
203
|
+
- - ! '>='
|
210
204
|
- !ruby/object:Gem::Version
|
211
|
-
version:
|
205
|
+
version: '0'
|
212
206
|
- !ruby/object:Gem::Dependency
|
213
207
|
name: rake
|
214
208
|
requirement: !ruby/object:Gem::Requirement
|
@@ -482,7 +476,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
482
476
|
version: '0'
|
483
477
|
segments:
|
484
478
|
- 0
|
485
|
-
hash: -
|
479
|
+
hash: -4065501124018437060
|
486
480
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
487
481
|
none: false
|
488
482
|
requirements:
|
@@ -491,7 +485,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
491
485
|
version: '0'
|
492
486
|
segments:
|
493
487
|
- 0
|
494
|
-
hash: -
|
488
|
+
hash: -4065501124018437060
|
495
489
|
requirements: []
|
496
490
|
rubyforge_project:
|
497
491
|
rubygems_version: 1.8.23
|