gds-sso 6.0.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -35,10 +35,11 @@ Create a `config/initializers/gds-sso.rb` that looks like:
35
35
  The user model must include the GDS::SSO::User module.
36
36
 
37
37
  It should have the following fields:
38
+
38
39
  string "name"
39
40
  string "email"
40
41
  string "uid"
41
- string "organisation"
42
+ string "organisation_slug"
42
43
  array "permissions"
43
44
  boolean "remotely_signed_out", :default => false
44
45
 
@@ -33,7 +33,7 @@ class Api::UserController < ApplicationController
33
33
  extra: {
34
34
  user: {
35
35
  permissions: user_json['permissions'],
36
- organisation: user_json['organisation'],
36
+ organisation_slug: user_json['organisation_slug'],
37
37
  }
38
38
  })
39
39
  end
data/lib/gds-sso/user.rb CHANGED
@@ -4,7 +4,7 @@ module GDS
4
4
  module SSO
5
5
  module User
6
6
  def included(base)
7
- attr_accessible :uid, :email, :name, :permissions, :organisation, as: :oauth
7
+ attr_accessible :uid, :email, :name, :permissions, :organisation_slug, as: :oauth
8
8
  end
9
9
 
10
10
  def has_permission?(permission)
@@ -19,7 +19,7 @@ module GDS
19
19
  'email' => auth_hash['info']['email'],
20
20
  'name' => auth_hash['info']['name'],
21
21
  'permissions' => auth_hash['extra']['user']['permissions'],
22
- 'organisation' => auth_hash['extra']['user']['organisation'],
22
+ 'organisation_slug' => auth_hash['extra']['user']['organisation_slug'],
23
23
  }
24
24
  end
25
25
 
@@ -1,5 +1,5 @@
1
1
  module GDS
2
2
  module SSO
3
- VERSION = "6.0.0"
3
+ VERSION = "7.0.0"
4
4
  end
5
5
  end
@@ -110,7 +110,7 @@ Warden::Strategies.add(:gds_bearer_token) do
110
110
  'extra' => {
111
111
  'user' => {
112
112
  'permissions' => input['permissions'],
113
- 'organisation' => input['organisation'],
113
+ 'organisation_slug' => input['organisation_slug'],
114
114
  }
115
115
  }
116
116
  }
@@ -7,7 +7,7 @@ def user_update_json
7
7
  "name" => "Joshua Marshall",
8
8
  "email" => "user@domain.com",
9
9
  "permissions" => ["signin", "new permission"],
10
- "organisation" => "justice-league"
10
+ "organisation_slug" => "justice-league"
11
11
  }
12
12
  }.to_json
13
13
  end
@@ -61,7 +61,7 @@ describe Api::UserController, type: :controller do
61
61
  expected_permissions = ["signin", "new permission"]
62
62
  assert_equal expected_permissions, @user_to_update.permissions
63
63
  expected_organisation = "justice-league"
64
- assert_equal expected_organisation, @user_to_update.organisation
64
+ assert_equal expected_organisation, @user_to_update.organisation_slug
65
65
  end
66
66
  end
67
67
 
@@ -3,5 +3,5 @@ class User < ActiveRecord::Base
3
3
 
4
4
  serialize :permissions, Array
5
5
 
6
- attr_accessible :uid, :email, :name, :permissions, :organisation, as: :oauth
6
+ attr_accessible :uid, :email, :name, :permissions, :organisation_slug, as: :oauth
7
7
  end
@@ -5,6 +5,6 @@ ActiveRecord::Schema.define do
5
5
  t.string "email", :null => false
6
6
  t.boolean "remotely_signed_out"
7
7
  t.text "permissions"
8
- t.string "organisation"
8
+ t.string "organisation_slug"
9
9
  end
10
10
  end