omniauth-crew-check 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env.example +1 -0
- data/.gitignore +23 -0
- data/.rspec +1 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +58 -0
- data/Rakefile +7 -0
- data/crew_check.gemspec +33 -0
- data/lib/crew_check/role_determination.rb +19 -0
- data/lib/crew_check/team.rb +24 -0
- data/lib/crew_check/team_list.rb +36 -0
- data/lib/crew_check/version.rb +3 -0
- data/lib/omniauth-crew-check.rb +5 -0
- data/lib/omniauth/strategies/crew_check.rb +45 -0
- data/spec/fixtures/vcr_cassettes/CrewCheck_TeamList/fetches_a_list_of_teams.yml +94 -0
- data/spec/fixtures/vcr_cassettes/CrewCheck_TeamList/has_a_list_of_shorthand_names.yml +94 -0
- data/spec/fixtures/vcr_cassettes/OmniAuth_Strategies_CrewCheck/provides_a_list_of_teams.yml +94 -0
- data/spec/fixtures/vcr_cassettes/OmniAuth_Strategies_CrewCheck/provides_an_unempty_list_of_teams.yml +94 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/support/_dotenv.rb +3 -0
- data/spec/support/vcr.rb +9 -0
- data/spec/unit/crew_check/role_determination_spec.rb +40 -0
- data/spec/unit/crew_check/team_list_spec.rb +16 -0
- data/spec/unit/crew_check/team_spec.rb +57 -0
- data/spec/unit/omniauth/strategies/crew_check_spec.rb +102 -0
- metadata +220 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 54574d7d771ee764ba4a57e5b27867ac99226710
|
4
|
+
data.tar.gz: 54f363989ccf9762de000dda57ac4ba928d90c45
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c891ae487c954e898b5899e47bd93d3d798730d7b38f13a36b3f13284c1c4080a1934f6f4906515c1efb8b984064d95003b244fef6d9bc7ccbabd3360af8b6ba
|
7
|
+
data.tar.gz: 28794697ae8ef11e072a669654b680a0647beef6f6e8cdfab546d7d4ab038efc6881a89da1c0415e963a053c36daa1ef9c71de81bb6dedf80fe58998ad9af7a8
|
data/.env.example
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
GITHUB_API_KEY=""
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
.env
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Dan Pickett
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# CrewCheck
|
2
|
+
|
3
|
+
CrewCheck helps you utilize github teams to correlate users with roles.
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
OmniAuth::Strategies::CrewCheck.new('github key', 'github secret',
|
7
|
+
:role_map => {
|
8
|
+
'admin' => ['acme/the-super-users'],
|
9
|
+
'moderators' => ['acme/the-regular-joes']
|
10
|
+
},
|
11
|
+
:role_required => true
|
12
|
+
)
|
13
|
+
```
|
14
|
+
|
15
|
+
You can also use a proc for the `role_map` option:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
OmniAuth::Strategies::CrewCheck.new('github key', 'github secret',
|
19
|
+
:role_map => ->{{
|
20
|
+
'admin' => Team.all.map{|i| 'acme/' + i.github_team_name }
|
21
|
+
}}
|
22
|
+
)
|
23
|
+
```
|
24
|
+
|
25
|
+
For a user that is part of the 'acme' github organization and is exclusively a github team member of 'the-super-users' OmniAuth will return data like:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
env['omniauth.auth'] = {
|
29
|
+
:provider => 'crew_check',
|
30
|
+
# ...
|
31
|
+
:extra => {
|
32
|
+
:teams => ['acme/the-super-users'],
|
33
|
+
:roles => ['admin']
|
34
|
+
}
|
35
|
+
}
|
36
|
+
```
|
37
|
+
|
38
|
+
## Installation
|
39
|
+
|
40
|
+
Add this line to your application's Gemfile:
|
41
|
+
|
42
|
+
gem 'crew_check'
|
43
|
+
|
44
|
+
And then execute:
|
45
|
+
|
46
|
+
$ bundle
|
47
|
+
|
48
|
+
Or install it yourself as:
|
49
|
+
|
50
|
+
$ gem install crew_check
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
1. Fork it ( https://github.com/[my-github-username]/crew_check/fork )
|
55
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
56
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
57
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
58
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/crew_check.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'crew_check/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniauth-crew-check"
|
8
|
+
spec.version = CrewCheck::VERSION
|
9
|
+
spec.authors = ["Dan Pickett"]
|
10
|
+
spec.email = ["dan.pickett@launchacademy.com"]
|
11
|
+
spec.summary = %q{Add authorized roles based on github team name}
|
12
|
+
spec.description = %q{Add authorized roles to omniauth payload based on github team name}
|
13
|
+
spec.homepage = "http://www.launchacademy.com"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
|
24
|
+
spec.add_dependency "omniauth-github"
|
25
|
+
spec.add_dependency "octokit"
|
26
|
+
|
27
|
+
spec.add_development_dependency "rspec"
|
28
|
+
spec.add_development_dependency "vcr"
|
29
|
+
spec.add_development_dependency "webmock"
|
30
|
+
spec.add_development_dependency "dotenv"
|
31
|
+
spec.add_development_dependency "mocha"
|
32
|
+
spec.add_development_dependency "rack-test"
|
33
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module CrewCheck
|
2
|
+
class RoleDetermination
|
3
|
+
def initialize(team_list, role_map)
|
4
|
+
@team_list = team_list
|
5
|
+
@role_map = role_map
|
6
|
+
end
|
7
|
+
|
8
|
+
def roles
|
9
|
+
unless @roles
|
10
|
+
@roles = []
|
11
|
+
@role_map.each do |role, team_list|
|
12
|
+
@roles << role.downcase if !(team_list & @team_list).empty?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
@roles
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module CrewCheck
|
2
|
+
class Team
|
3
|
+
def initialize(github_team = nil)
|
4
|
+
@github_team = github_team
|
5
|
+
end
|
6
|
+
|
7
|
+
def shorthand_name
|
8
|
+
"#{organization_name}/#{name}"
|
9
|
+
end
|
10
|
+
|
11
|
+
protected
|
12
|
+
def name
|
13
|
+
if @github_team[:name]
|
14
|
+
@github_team[:name].downcase
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def organization_name
|
19
|
+
if @github_team[:organization] && @github_team[:organization][:login]
|
20
|
+
@github_team[:organization][:login].downcase
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'crew_check/team'
|
2
|
+
|
3
|
+
require 'octokit'
|
4
|
+
|
5
|
+
module CrewCheck
|
6
|
+
class TeamList
|
7
|
+
include Enumerable
|
8
|
+
|
9
|
+
def initialize(github_teams = [])
|
10
|
+
@teams = github_teams.map do |gh_team|
|
11
|
+
CrewCheck::Team.new(gh_team)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def shorthand_names
|
16
|
+
@teams.map do |team|
|
17
|
+
team.shorthand_name
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class << self
|
22
|
+
def fetch(token)
|
23
|
+
client = Octokit::Client.new(access_token: token)
|
24
|
+
new(client.user_teams)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def each(&block)
|
29
|
+
@teams.each(&block)
|
30
|
+
end
|
31
|
+
|
32
|
+
def empty?
|
33
|
+
@teams.size == 0
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'omniauth-github'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class CrewCheck < OmniAuth::Strategies::GitHub
|
6
|
+
option :name, :crew_check
|
7
|
+
option :role_map, {}
|
8
|
+
option :role_required, true
|
9
|
+
|
10
|
+
extra do
|
11
|
+
{
|
12
|
+
:raw_info => raw_info,
|
13
|
+
:teams => teams,
|
14
|
+
:roles => roles
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
def callback_phase
|
19
|
+
if options.role_required && roles.empty?
|
20
|
+
fail!(:invalid_credentials)
|
21
|
+
else
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
def teams
|
28
|
+
@teams ||= ::CrewCheck::TeamList.fetch(gh_token)
|
29
|
+
end
|
30
|
+
|
31
|
+
def roles
|
32
|
+
map = options.role_map.kind_of?(Proc) ? options.role_map.call : options.role_map
|
33
|
+
::CrewCheck::RoleDetermination.new(
|
34
|
+
teams.shorthand_names,
|
35
|
+
map).roles
|
36
|
+
end
|
37
|
+
|
38
|
+
def gh_token
|
39
|
+
credentials['token']
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
OmniAuth.config.add_camelization 'crew_check', 'CrewCheck'
|
@@ -0,0 +1,94 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.github.com/user/teams
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/vnd.github.v3+json
|
12
|
+
User-Agent:
|
13
|
+
- Octokit Ruby Gem 3.2.0
|
14
|
+
Authorization:
|
15
|
+
- token <GITHUB_API_KEY>
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- GitHub.com
|
25
|
+
Date:
|
26
|
+
- Thu, 07 Aug 2014 18:51:46 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Status:
|
32
|
+
- 200 OK
|
33
|
+
X-Ratelimit-Limit:
|
34
|
+
- '5000'
|
35
|
+
X-Ratelimit-Remaining:
|
36
|
+
- '4945'
|
37
|
+
X-Ratelimit-Reset:
|
38
|
+
- '1407438144'
|
39
|
+
Cache-Control:
|
40
|
+
- private, max-age=60, s-maxage=60
|
41
|
+
Etag:
|
42
|
+
- '"08401136adb11453d2fa2338facff580"'
|
43
|
+
X-Oauth-Scopes:
|
44
|
+
- gist, repo, user
|
45
|
+
X-Accepted-Oauth-Scopes:
|
46
|
+
- admin:org, read:org, repo, user, write:org
|
47
|
+
Vary:
|
48
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
49
|
+
- Accept-Encoding
|
50
|
+
X-Github-Media-Type:
|
51
|
+
- github.v3; format=json
|
52
|
+
X-Xss-Protection:
|
53
|
+
- 1; mode=block
|
54
|
+
X-Frame-Options:
|
55
|
+
- deny
|
56
|
+
Content-Security-Policy:
|
57
|
+
- default-src 'none'
|
58
|
+
Access-Control-Allow-Credentials:
|
59
|
+
- 'true'
|
60
|
+
Access-Control-Expose-Headers:
|
61
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
62
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
63
|
+
Access-Control-Allow-Origin:
|
64
|
+
- "*"
|
65
|
+
X-Github-Request-Id:
|
66
|
+
- 32F17FD1:5530:726247D:53E3CAC1
|
67
|
+
Strict-Transport-Security:
|
68
|
+
- max-age=31536000; includeSubdomains
|
69
|
+
X-Content-Type-Options:
|
70
|
+
- nosniff
|
71
|
+
X-Served-By:
|
72
|
+
- 6d7de9e645814cac34ea2a8d72ba3141
|
73
|
+
body:
|
74
|
+
encoding: UTF-8
|
75
|
+
string: '[{"name":"Owners","id":340003,"slug":"owners","permission":"admin","url":"https://api.github.com/teams/340003","members_url":"https://api.github.com/teams/340003/members{/member}","repositories_url":"https://api.github.com/teams/340003/repos","members_count":11,"repos_count":190,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
76
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
77
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"Bot","id":345064,"slug":"bot","permission":"admin","url":"https://api.github.com/teams/345064","members_url":"https://api.github.com/teams/345064/members{/member}","repositories_url":"https://api.github.com/teams/345064/repos","members_count":1,"repos_count":4,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
78
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
79
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"latest","id":458370,"slug":"latest","permission":"admin","url":"https://api.github.com/teams/458370","members_url":"https://api.github.com/teams/458370/members{/member}","repositories_url":"https://api.github.com/teams/458370/repos","members_count":1,"repos_count":0,"organization":{"login":"LaunchAcademyEDU","id":5073731,"url":"https://api.github.com/orgs/LaunchAcademyEDU","repos_url":"https://api.github.com/orgs/LaunchAcademyEDU/repos","events_url":"https://api.github.com/orgs/LaunchAcademyEDU/events","members_url":"https://api.github.com/orgs/LaunchAcademyEDU/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademyEDU/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/5073731?v=2","name":"Launch
|
80
|
+
Academy","company":null,"blog":"http://www.launchacademy.com","location":"Boston,
|
81
|
+
MA","email":"hello@launchacademy.com","public_repos":9,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademyEDU","created_at":"2013-07-23T14:22:32Z","updated_at":"2014-06-10T20:16:56Z","type":"Organization"}},{"name":"winter-2013","id":488810,"slug":"winter-2013","permission":"push","url":"https://api.github.com/teams/488810","members_url":"https://api.github.com/teams/488810/members{/member}","repositories_url":"https://api.github.com/teams/488810/repos","members_count":48,"repos_count":8,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
82
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
83
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"spring-2014","id":574495,"slug":"spring-2014","permission":"push","url":"https://api.github.com/teams/574495","members_url":"https://api.github.com/teams/574495/members{/member}","repositories_url":"https://api.github.com/teams/574495/repos","members_count":43,"repos_count":37,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
84
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
85
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"summer-2014","id":656047,"slug":"summer-2014","permission":"push","url":"https://api.github.com/teams/656047","members_url":"https://api.github.com/teams/656047/members{/member}","repositories_url":"https://api.github.com/teams/656047/repos","members_count":51,"repos_count":2,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
86
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
87
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"spring-2014-read-only","id":744182,"slug":"spring-2014-read-only","permission":"pull","url":"https://api.github.com/teams/744182","members_url":"https://api.github.com/teams/744182/members{/member}","repositories_url":"https://api.github.com/teams/744182/repos","members_count":45,"repos_count":156,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
88
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
89
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"capital-one-preview","id":942647,"slug":"capital-one-preview","permission":"pull","url":"https://api.github.com/teams/942647","members_url":"https://api.github.com/teams/942647/members{/member}","repositories_url":"https://api.github.com/teams/942647/repos","members_count":10,"repos_count":0,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
90
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
91
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}}]'
|
92
|
+
http_version:
|
93
|
+
recorded_at: Thu, 07 Aug 2014 18:51:46 GMT
|
94
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,94 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.github.com/user/teams
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/vnd.github.v3+json
|
12
|
+
User-Agent:
|
13
|
+
- Octokit Ruby Gem 3.2.0
|
14
|
+
Authorization:
|
15
|
+
- token <GITHUB_API_KEY>
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- GitHub.com
|
25
|
+
Date:
|
26
|
+
- Thu, 07 Aug 2014 19:01:52 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Status:
|
32
|
+
- 200 OK
|
33
|
+
X-Ratelimit-Limit:
|
34
|
+
- '5000'
|
35
|
+
X-Ratelimit-Remaining:
|
36
|
+
- '4942'
|
37
|
+
X-Ratelimit-Reset:
|
38
|
+
- '1407438144'
|
39
|
+
Cache-Control:
|
40
|
+
- private, max-age=60, s-maxage=60
|
41
|
+
Etag:
|
42
|
+
- '"08401136adb11453d2fa2338facff580"'
|
43
|
+
X-Oauth-Scopes:
|
44
|
+
- gist, repo, user
|
45
|
+
X-Accepted-Oauth-Scopes:
|
46
|
+
- admin:org, read:org, repo, user, write:org
|
47
|
+
Vary:
|
48
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
49
|
+
- Accept-Encoding
|
50
|
+
X-Github-Media-Type:
|
51
|
+
- github.v3; format=json
|
52
|
+
X-Xss-Protection:
|
53
|
+
- 1; mode=block
|
54
|
+
X-Frame-Options:
|
55
|
+
- deny
|
56
|
+
Content-Security-Policy:
|
57
|
+
- default-src 'none'
|
58
|
+
Access-Control-Allow-Credentials:
|
59
|
+
- 'true'
|
60
|
+
Access-Control-Expose-Headers:
|
61
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
62
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
63
|
+
Access-Control-Allow-Origin:
|
64
|
+
- "*"
|
65
|
+
X-Github-Request-Id:
|
66
|
+
- 32F17FD1:1E52:2E0D72A:53E3CD20
|
67
|
+
Strict-Transport-Security:
|
68
|
+
- max-age=31536000; includeSubdomains
|
69
|
+
X-Content-Type-Options:
|
70
|
+
- nosniff
|
71
|
+
X-Served-By:
|
72
|
+
- 3061975e1f37121b3751604ad153c687
|
73
|
+
body:
|
74
|
+
encoding: UTF-8
|
75
|
+
string: '[{"name":"Owners","id":340003,"slug":"owners","permission":"admin","url":"https://api.github.com/teams/340003","members_url":"https://api.github.com/teams/340003/members{/member}","repositories_url":"https://api.github.com/teams/340003/repos","members_count":11,"repos_count":190,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
76
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
77
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"Bot","id":345064,"slug":"bot","permission":"admin","url":"https://api.github.com/teams/345064","members_url":"https://api.github.com/teams/345064/members{/member}","repositories_url":"https://api.github.com/teams/345064/repos","members_count":1,"repos_count":4,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
78
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
79
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"latest","id":458370,"slug":"latest","permission":"admin","url":"https://api.github.com/teams/458370","members_url":"https://api.github.com/teams/458370/members{/member}","repositories_url":"https://api.github.com/teams/458370/repos","members_count":1,"repos_count":0,"organization":{"login":"LaunchAcademyEDU","id":5073731,"url":"https://api.github.com/orgs/LaunchAcademyEDU","repos_url":"https://api.github.com/orgs/LaunchAcademyEDU/repos","events_url":"https://api.github.com/orgs/LaunchAcademyEDU/events","members_url":"https://api.github.com/orgs/LaunchAcademyEDU/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademyEDU/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/5073731?v=2","name":"Launch
|
80
|
+
Academy","company":null,"blog":"http://www.launchacademy.com","location":"Boston,
|
81
|
+
MA","email":"hello@launchacademy.com","public_repos":9,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademyEDU","created_at":"2013-07-23T14:22:32Z","updated_at":"2014-06-10T20:16:56Z","type":"Organization"}},{"name":"winter-2013","id":488810,"slug":"winter-2013","permission":"push","url":"https://api.github.com/teams/488810","members_url":"https://api.github.com/teams/488810/members{/member}","repositories_url":"https://api.github.com/teams/488810/repos","members_count":48,"repos_count":8,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
82
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
83
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"spring-2014","id":574495,"slug":"spring-2014","permission":"push","url":"https://api.github.com/teams/574495","members_url":"https://api.github.com/teams/574495/members{/member}","repositories_url":"https://api.github.com/teams/574495/repos","members_count":43,"repos_count":37,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
84
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
85
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"summer-2014","id":656047,"slug":"summer-2014","permission":"push","url":"https://api.github.com/teams/656047","members_url":"https://api.github.com/teams/656047/members{/member}","repositories_url":"https://api.github.com/teams/656047/repos","members_count":51,"repos_count":2,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
86
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
87
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"spring-2014-read-only","id":744182,"slug":"spring-2014-read-only","permission":"pull","url":"https://api.github.com/teams/744182","members_url":"https://api.github.com/teams/744182/members{/member}","repositories_url":"https://api.github.com/teams/744182/repos","members_count":45,"repos_count":156,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
88
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
89
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"capital-one-preview","id":942647,"slug":"capital-one-preview","permission":"pull","url":"https://api.github.com/teams/942647","members_url":"https://api.github.com/teams/942647/members{/member}","repositories_url":"https://api.github.com/teams/942647/repos","members_count":10,"repos_count":0,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
90
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
91
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}}]'
|
92
|
+
http_version:
|
93
|
+
recorded_at: Thu, 07 Aug 2014 19:01:52 GMT
|
94
|
+
recorded_with: VCR 2.9.2
|
@@ -0,0 +1,94 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.github.com/user/teams
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/vnd.github.v3+json
|
12
|
+
User-Agent:
|
13
|
+
- Octokit Ruby Gem 3.2.0
|
14
|
+
Authorization:
|
15
|
+
- token <GITHUB_API_KEY>
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- GitHub.com
|
25
|
+
Date:
|
26
|
+
- Thu, 07 Aug 2014 18:51:46 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Status:
|
32
|
+
- 200 OK
|
33
|
+
X-Ratelimit-Limit:
|
34
|
+
- '5000'
|
35
|
+
X-Ratelimit-Remaining:
|
36
|
+
- '4944'
|
37
|
+
X-Ratelimit-Reset:
|
38
|
+
- '1407438144'
|
39
|
+
Cache-Control:
|
40
|
+
- private, max-age=60, s-maxage=60
|
41
|
+
Etag:
|
42
|
+
- '"08401136adb11453d2fa2338facff580"'
|
43
|
+
X-Oauth-Scopes:
|
44
|
+
- gist, repo, user
|
45
|
+
X-Accepted-Oauth-Scopes:
|
46
|
+
- admin:org, read:org, repo, user, write:org
|
47
|
+
Vary:
|
48
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
49
|
+
- Accept-Encoding
|
50
|
+
X-Github-Media-Type:
|
51
|
+
- github.v3; format=json
|
52
|
+
X-Xss-Protection:
|
53
|
+
- 1; mode=block
|
54
|
+
X-Frame-Options:
|
55
|
+
- deny
|
56
|
+
Content-Security-Policy:
|
57
|
+
- default-src 'none'
|
58
|
+
Access-Control-Allow-Credentials:
|
59
|
+
- 'true'
|
60
|
+
Access-Control-Expose-Headers:
|
61
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
62
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
63
|
+
Access-Control-Allow-Origin:
|
64
|
+
- "*"
|
65
|
+
X-Github-Request-Id:
|
66
|
+
- 32F17FD1:552B:1440610:53E3CAC2
|
67
|
+
Strict-Transport-Security:
|
68
|
+
- max-age=31536000; includeSubdomains
|
69
|
+
X-Content-Type-Options:
|
70
|
+
- nosniff
|
71
|
+
X-Served-By:
|
72
|
+
- 88d924ed861736d2749ce1a55766cb53
|
73
|
+
body:
|
74
|
+
encoding: UTF-8
|
75
|
+
string: '[{"name":"Owners","id":340003,"slug":"owners","permission":"admin","url":"https://api.github.com/teams/340003","members_url":"https://api.github.com/teams/340003/members{/member}","repositories_url":"https://api.github.com/teams/340003/repos","members_count":11,"repos_count":190,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
76
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
77
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"Bot","id":345064,"slug":"bot","permission":"admin","url":"https://api.github.com/teams/345064","members_url":"https://api.github.com/teams/345064/members{/member}","repositories_url":"https://api.github.com/teams/345064/repos","members_count":1,"repos_count":4,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
78
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
79
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"latest","id":458370,"slug":"latest","permission":"admin","url":"https://api.github.com/teams/458370","members_url":"https://api.github.com/teams/458370/members{/member}","repositories_url":"https://api.github.com/teams/458370/repos","members_count":1,"repos_count":0,"organization":{"login":"LaunchAcademyEDU","id":5073731,"url":"https://api.github.com/orgs/LaunchAcademyEDU","repos_url":"https://api.github.com/orgs/LaunchAcademyEDU/repos","events_url":"https://api.github.com/orgs/LaunchAcademyEDU/events","members_url":"https://api.github.com/orgs/LaunchAcademyEDU/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademyEDU/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/5073731?v=2","name":"Launch
|
80
|
+
Academy","company":null,"blog":"http://www.launchacademy.com","location":"Boston,
|
81
|
+
MA","email":"hello@launchacademy.com","public_repos":9,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademyEDU","created_at":"2013-07-23T14:22:32Z","updated_at":"2014-06-10T20:16:56Z","type":"Organization"}},{"name":"winter-2013","id":488810,"slug":"winter-2013","permission":"push","url":"https://api.github.com/teams/488810","members_url":"https://api.github.com/teams/488810/members{/member}","repositories_url":"https://api.github.com/teams/488810/repos","members_count":48,"repos_count":8,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
82
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
83
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"spring-2014","id":574495,"slug":"spring-2014","permission":"push","url":"https://api.github.com/teams/574495","members_url":"https://api.github.com/teams/574495/members{/member}","repositories_url":"https://api.github.com/teams/574495/repos","members_count":43,"repos_count":37,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
84
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
85
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"summer-2014","id":656047,"slug":"summer-2014","permission":"push","url":"https://api.github.com/teams/656047","members_url":"https://api.github.com/teams/656047/members{/member}","repositories_url":"https://api.github.com/teams/656047/repos","members_count":51,"repos_count":2,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
86
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
87
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"spring-2014-read-only","id":744182,"slug":"spring-2014-read-only","permission":"pull","url":"https://api.github.com/teams/744182","members_url":"https://api.github.com/teams/744182/members{/member}","repositories_url":"https://api.github.com/teams/744182/repos","members_count":45,"repos_count":156,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
88
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
89
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"capital-one-preview","id":942647,"slug":"capital-one-preview","permission":"pull","url":"https://api.github.com/teams/942647","members_url":"https://api.github.com/teams/942647/members{/member}","repositories_url":"https://api.github.com/teams/942647/repos","members_count":10,"repos_count":0,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
90
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
91
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}}]'
|
92
|
+
http_version:
|
93
|
+
recorded_at: Thu, 07 Aug 2014 18:51:46 GMT
|
94
|
+
recorded_with: VCR 2.9.2
|
data/spec/fixtures/vcr_cassettes/OmniAuth_Strategies_CrewCheck/provides_an_unempty_list_of_teams.yml
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.github.com/user/teams
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/vnd.github.v3+json
|
12
|
+
User-Agent:
|
13
|
+
- Octokit Ruby Gem 3.2.0
|
14
|
+
Authorization:
|
15
|
+
- token <GITHUB_API_KEY>
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- GitHub.com
|
25
|
+
Date:
|
26
|
+
- Thu, 07 Aug 2014 18:51:46 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Status:
|
32
|
+
- 200 OK
|
33
|
+
X-Ratelimit-Limit:
|
34
|
+
- '5000'
|
35
|
+
X-Ratelimit-Remaining:
|
36
|
+
- '4943'
|
37
|
+
X-Ratelimit-Reset:
|
38
|
+
- '1407438144'
|
39
|
+
Cache-Control:
|
40
|
+
- private, max-age=60, s-maxage=60
|
41
|
+
Etag:
|
42
|
+
- '"08401136adb11453d2fa2338facff580"'
|
43
|
+
X-Oauth-Scopes:
|
44
|
+
- gist, repo, user
|
45
|
+
X-Accepted-Oauth-Scopes:
|
46
|
+
- admin:org, read:org, repo, user, write:org
|
47
|
+
Vary:
|
48
|
+
- Accept, Authorization, Cookie, X-GitHub-OTP
|
49
|
+
- Accept-Encoding
|
50
|
+
X-Github-Media-Type:
|
51
|
+
- github.v3; format=json
|
52
|
+
X-Xss-Protection:
|
53
|
+
- 1; mode=block
|
54
|
+
X-Frame-Options:
|
55
|
+
- deny
|
56
|
+
Content-Security-Policy:
|
57
|
+
- default-src 'none'
|
58
|
+
Access-Control-Allow-Credentials:
|
59
|
+
- 'true'
|
60
|
+
Access-Control-Expose-Headers:
|
61
|
+
- ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,
|
62
|
+
X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
|
63
|
+
Access-Control-Allow-Origin:
|
64
|
+
- "*"
|
65
|
+
X-Github-Request-Id:
|
66
|
+
- 32F17FD1:552E:4F96642:53E3CAC2
|
67
|
+
Strict-Transport-Security:
|
68
|
+
- max-age=31536000; includeSubdomains
|
69
|
+
X-Content-Type-Options:
|
70
|
+
- nosniff
|
71
|
+
X-Served-By:
|
72
|
+
- 88d924ed861736d2749ce1a55766cb53
|
73
|
+
body:
|
74
|
+
encoding: UTF-8
|
75
|
+
string: '[{"name":"Owners","id":340003,"slug":"owners","permission":"admin","url":"https://api.github.com/teams/340003","members_url":"https://api.github.com/teams/340003/members{/member}","repositories_url":"https://api.github.com/teams/340003/repos","members_count":11,"repos_count":190,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
76
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
77
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"Bot","id":345064,"slug":"bot","permission":"admin","url":"https://api.github.com/teams/345064","members_url":"https://api.github.com/teams/345064/members{/member}","repositories_url":"https://api.github.com/teams/345064/repos","members_count":1,"repos_count":4,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
78
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
79
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"latest","id":458370,"slug":"latest","permission":"admin","url":"https://api.github.com/teams/458370","members_url":"https://api.github.com/teams/458370/members{/member}","repositories_url":"https://api.github.com/teams/458370/repos","members_count":1,"repos_count":0,"organization":{"login":"LaunchAcademyEDU","id":5073731,"url":"https://api.github.com/orgs/LaunchAcademyEDU","repos_url":"https://api.github.com/orgs/LaunchAcademyEDU/repos","events_url":"https://api.github.com/orgs/LaunchAcademyEDU/events","members_url":"https://api.github.com/orgs/LaunchAcademyEDU/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademyEDU/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/5073731?v=2","name":"Launch
|
80
|
+
Academy","company":null,"blog":"http://www.launchacademy.com","location":"Boston,
|
81
|
+
MA","email":"hello@launchacademy.com","public_repos":9,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademyEDU","created_at":"2013-07-23T14:22:32Z","updated_at":"2014-06-10T20:16:56Z","type":"Organization"}},{"name":"winter-2013","id":488810,"slug":"winter-2013","permission":"push","url":"https://api.github.com/teams/488810","members_url":"https://api.github.com/teams/488810/members{/member}","repositories_url":"https://api.github.com/teams/488810/repos","members_count":48,"repos_count":8,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
82
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
83
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"spring-2014","id":574495,"slug":"spring-2014","permission":"push","url":"https://api.github.com/teams/574495","members_url":"https://api.github.com/teams/574495/members{/member}","repositories_url":"https://api.github.com/teams/574495/repos","members_count":43,"repos_count":37,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
84
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
85
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"summer-2014","id":656047,"slug":"summer-2014","permission":"push","url":"https://api.github.com/teams/656047","members_url":"https://api.github.com/teams/656047/members{/member}","repositories_url":"https://api.github.com/teams/656047/repos","members_count":51,"repos_count":2,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
86
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
87
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"spring-2014-read-only","id":744182,"slug":"spring-2014-read-only","permission":"pull","url":"https://api.github.com/teams/744182","members_url":"https://api.github.com/teams/744182/members{/member}","repositories_url":"https://api.github.com/teams/744182/repos","members_count":45,"repos_count":156,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
88
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
89
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}},{"name":"capital-one-preview","id":942647,"slug":"capital-one-preview","permission":"pull","url":"https://api.github.com/teams/942647","members_url":"https://api.github.com/teams/942647/members{/member}","repositories_url":"https://api.github.com/teams/942647/repos","members_count":10,"repos_count":0,"organization":{"login":"LaunchAcademy","id":3612691,"url":"https://api.github.com/orgs/LaunchAcademy","repos_url":"https://api.github.com/orgs/LaunchAcademy/repos","events_url":"https://api.github.com/orgs/LaunchAcademy/events","members_url":"https://api.github.com/orgs/LaunchAcademy/members{/member}","public_members_url":"https://api.github.com/orgs/LaunchAcademy/public_members{/member}","avatar_url":"https://avatars.githubusercontent.com/u/3612691?v=2","name":"Launch
|
90
|
+
Academy","company":null,"blog":"http://launchacademy.com","location":"Boston,
|
91
|
+
MA","email":"hello@launchacademy.com","public_repos":89,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/LaunchAcademy","created_at":"2013-02-16T18:16:02Z","updated_at":"2014-08-07T18:35:21Z","type":"Organization"}}]'
|
92
|
+
http_version:
|
93
|
+
recorded_at: Thu, 07 Aug 2014 18:51:46 GMT
|
94
|
+
recorded_with: VCR 2.9.2
|
data/spec/spec_helper.rb
ADDED
data/spec/support/vcr.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
|
3
|
+
VCR.configure do |c|
|
4
|
+
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
5
|
+
c.hook_into :webmock # or :fakeweb
|
6
|
+
c.default_cassette_options = { :record => :new_episodes }
|
7
|
+
c.configure_rspec_metadata!
|
8
|
+
c.filter_sensitive_data('<GITHUB_API_KEY>') { ENV['GITHUB_TOKEN'] }
|
9
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CrewCheck::RoleDetermination do
|
4
|
+
let(:admin_teams) do
|
5
|
+
[
|
6
|
+
'launchacademy/experience engineers'
|
7
|
+
]
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:guest_lecturer_team) do
|
11
|
+
'launchacademy/guest lecturer'
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:role_map) do
|
15
|
+
{
|
16
|
+
'admin' => admin_teams,
|
17
|
+
'users' => ['launchacademy/students'],
|
18
|
+
'educator' => [guest_lecturer_team]
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
let(:role_determination) do
|
23
|
+
CrewCheck::RoleDetermination.new(admin_teams, role_map)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'calculates the list of effective roles' do
|
27
|
+
expect(role_determination.roles).to eq(['admin'])
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'allows for multiple roles' do
|
31
|
+
admin_teams << guest_lecturer_team
|
32
|
+
expect(role_determination.roles).to eq(['admin', 'educator'])
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'returns an empty set if a team is not found' do
|
36
|
+
other_teams = ['launchacademy/something crazy']
|
37
|
+
role_determination = CrewCheck::RoleDetermination.new(other_teams, role_map)
|
38
|
+
expect(role_determination.roles).to eq([])
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CrewCheck::TeamList, vcr: true do
|
4
|
+
let(:github_token) { ENV['GITHUB_TOKEN'] }
|
5
|
+
|
6
|
+
it 'fetches a list of teams' do
|
7
|
+
list = CrewCheck::TeamList.fetch(github_token)
|
8
|
+
expect(list).to_not be_empty
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'has a list of shorthand names' do
|
12
|
+
list = CrewCheck::TeamList.fetch(github_token)
|
13
|
+
expect(list.shorthand_names).to_not be_nil
|
14
|
+
expect(list.shorthand_names).to_not be_empty
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CrewCheck::Team do
|
4
|
+
let(:github_team) do
|
5
|
+
{
|
6
|
+
:name=>"team blue",
|
7
|
+
:id=>123123123123123,
|
8
|
+
:slug=>"team-blue",
|
9
|
+
:permission=>"admin",
|
10
|
+
:url=>"https://api.github.com/teams/123123123123123",
|
11
|
+
:members_url=>"https://api.github.com/teams/123123123123123/members{/member}",
|
12
|
+
:repositories_url=>"https://api.github.com/teams/123123123123123/repos",
|
13
|
+
:members_count=>11,
|
14
|
+
:repos_count=>190,
|
15
|
+
:organization=> {
|
16
|
+
:login=>"LaunchAcademy",
|
17
|
+
:id=>3612691,
|
18
|
+
:url=>"https://api.github.com/orgs/LaunchAcademy",
|
19
|
+
:repos_url=>"https://api.github.com/orgs/LaunchAcademy/repos",
|
20
|
+
:events_url=>"https://api.github.com/orgs/LaunchAcademy/events",
|
21
|
+
:members_url=>"https://api.github.com/orgs/LaunchAcademy/members{/member}",
|
22
|
+
:public_members_url=>
|
23
|
+
"https://api.github.com/orgs/LaunchAcademy/public_members{/member}",
|
24
|
+
:avatar_url=>"https://avatars.githubusercontent.com/u/3612691?v=2",
|
25
|
+
:name=>"Launch Academy",
|
26
|
+
:company=>nil,
|
27
|
+
:blog=>"http://launchacademy.com",
|
28
|
+
:location=>"Boston, MA",
|
29
|
+
:email=>"hello@launchacademy.com",
|
30
|
+
:public_repos=>89,
|
31
|
+
:public_gists=>0,
|
32
|
+
:followers=>0,
|
33
|
+
:following=>0,
|
34
|
+
:html_url=>"https://github.com/LaunchAcademy",
|
35
|
+
:created_at=> Time.parse("2013-02-16 18:16:02 UTC"),
|
36
|
+
:updated_at=> Time.parse("2014-08-07 18:35:21 UTC"),
|
37
|
+
:type=>"Organization"
|
38
|
+
}
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
let(:team) do
|
43
|
+
CrewCheck::Team.new(github_team)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'has a shorthand name' do
|
47
|
+
expect(team.shorthand_name).to_not be_nil
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'has a shorthand name that includes the organization login' do
|
51
|
+
expect(team.shorthand_name).to include(github_team[:organization][:login].downcase)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'has a shorthand nmae that includes the team name' do
|
55
|
+
expect(team.shorthand_name).to include(github_team[:name].downcase)
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require "rack/test"
|
3
|
+
require 'omniauth/test'
|
4
|
+
|
5
|
+
describe OmniAuth::Strategies::CrewCheck, vcr: true do
|
6
|
+
let(:parsed_response) { mock('Parsed Response') }
|
7
|
+
let(:response) do
|
8
|
+
mock('Response').tap do |m|
|
9
|
+
m.stubs(:parsed).returns(parsed_response)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:access_token) do
|
14
|
+
mock.tap do |m|
|
15
|
+
m.stubs(:options).returns({})
|
16
|
+
m.stubs(:token).returns(ENV['GITHUB_TOKEN'])
|
17
|
+
m.stubs(:expires?).returns(false)
|
18
|
+
m.stubs(:get).returns(response)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
let(:mock_team_list) do
|
24
|
+
mock('Team List').tap do |m|
|
25
|
+
m.stubs(:shorthand_names).returns(['launchacademy/experience engineers'])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
let(:role_map) do
|
30
|
+
{
|
31
|
+
'admin' => ['launchacademy/experience engineers']
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
let(:strategy) do
|
36
|
+
OmniAuth::Strategies::CrewCheck.new('github key', 'github secret',
|
37
|
+
:role_map => role_map).tap do |s|
|
38
|
+
|
39
|
+
s.stubs(:teams).returns(mock_team_list)
|
40
|
+
s.stubs(:access_token).returns(access_token)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'provides a list of teams' do
|
45
|
+
expect(strategy.extra[:teams]).to_not be_nil
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'provides an unempty list of roles' do
|
49
|
+
expect(strategy.extra[:roles]).to eq(['admin'])
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
context 'proc support' do
|
54
|
+
let(:strategy) do
|
55
|
+
the_proc = ->{{
|
56
|
+
'admin' => mock_team_list.shorthand_names
|
57
|
+
}}
|
58
|
+
|
59
|
+
OmniAuth::Strategies::CrewCheck.new('github key', 'github secret', :role_map => the_proc).tap do |s|
|
60
|
+
|
61
|
+
s.stubs(:teams).returns(mock_team_list)
|
62
|
+
s.stubs(:access_token).returns(access_token)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'allows a proc for the role map' do
|
67
|
+
expect(strategy.extra[:roles]).to eq(['admin'])
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context 'requiring a role' do
|
72
|
+
let(:role_map) do
|
73
|
+
{
|
74
|
+
'admin' => ['launchacademy/nerds']
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
let(:mock_request) do
|
79
|
+
Rack::Request.new(::Rack::MockRequest.env_for('/'))
|
80
|
+
end
|
81
|
+
|
82
|
+
let(:strategy) do
|
83
|
+
OmniAuth::Strategies::CrewCheck.new('github key', 'github secret', {
|
84
|
+
:role_map => role_map,
|
85
|
+
:role_required => true,
|
86
|
+
:provider_ignores_state => true
|
87
|
+
}).tap do |s|
|
88
|
+
|
89
|
+
s.stubs(:teams).returns(mock_team_list)
|
90
|
+
s.stubs(:access_token).returns(access_token)
|
91
|
+
s.stubs(:request).returns(mock_request)
|
92
|
+
s.stubs(:env).returns({})
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'fails if a role is not found for the list of teams' do
|
97
|
+
callback = strategy.callback_phase
|
98
|
+
expect(callback[0]).to eql(302)
|
99
|
+
expect(callback[1]['Location']).to include('invalid_credentials')
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
metadata
ADDED
@@ -0,0 +1,220 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-crew-check
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dan Pickett
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: omniauth-github
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: octokit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: vcr
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: dotenv
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: mocha
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rack-test
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description: Add authorized roles to omniauth payload based on github team name
|
154
|
+
email:
|
155
|
+
- dan.pickett@launchacademy.com
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".env.example"
|
161
|
+
- ".gitignore"
|
162
|
+
- ".rspec"
|
163
|
+
- Gemfile
|
164
|
+
- LICENSE.txt
|
165
|
+
- README.md
|
166
|
+
- Rakefile
|
167
|
+
- crew_check.gemspec
|
168
|
+
- lib/crew_check/role_determination.rb
|
169
|
+
- lib/crew_check/team.rb
|
170
|
+
- lib/crew_check/team_list.rb
|
171
|
+
- lib/crew_check/version.rb
|
172
|
+
- lib/omniauth-crew-check.rb
|
173
|
+
- lib/omniauth/strategies/crew_check.rb
|
174
|
+
- spec/fixtures/vcr_cassettes/CrewCheck_TeamList/fetches_a_list_of_teams.yml
|
175
|
+
- spec/fixtures/vcr_cassettes/CrewCheck_TeamList/has_a_list_of_shorthand_names.yml
|
176
|
+
- spec/fixtures/vcr_cassettes/OmniAuth_Strategies_CrewCheck/provides_a_list_of_teams.yml
|
177
|
+
- spec/fixtures/vcr_cassettes/OmniAuth_Strategies_CrewCheck/provides_an_unempty_list_of_teams.yml
|
178
|
+
- spec/spec_helper.rb
|
179
|
+
- spec/support/_dotenv.rb
|
180
|
+
- spec/support/vcr.rb
|
181
|
+
- spec/unit/crew_check/role_determination_spec.rb
|
182
|
+
- spec/unit/crew_check/team_list_spec.rb
|
183
|
+
- spec/unit/crew_check/team_spec.rb
|
184
|
+
- spec/unit/omniauth/strategies/crew_check_spec.rb
|
185
|
+
homepage: http://www.launchacademy.com
|
186
|
+
licenses:
|
187
|
+
- MIT
|
188
|
+
metadata: {}
|
189
|
+
post_install_message:
|
190
|
+
rdoc_options: []
|
191
|
+
require_paths:
|
192
|
+
- lib
|
193
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
194
|
+
requirements:
|
195
|
+
- - ">="
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
198
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
|
+
requirements:
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: '0'
|
203
|
+
requirements: []
|
204
|
+
rubyforge_project:
|
205
|
+
rubygems_version: 2.2.2
|
206
|
+
signing_key:
|
207
|
+
specification_version: 4
|
208
|
+
summary: Add authorized roles based on github team name
|
209
|
+
test_files:
|
210
|
+
- spec/fixtures/vcr_cassettes/CrewCheck_TeamList/fetches_a_list_of_teams.yml
|
211
|
+
- spec/fixtures/vcr_cassettes/CrewCheck_TeamList/has_a_list_of_shorthand_names.yml
|
212
|
+
- spec/fixtures/vcr_cassettes/OmniAuth_Strategies_CrewCheck/provides_a_list_of_teams.yml
|
213
|
+
- spec/fixtures/vcr_cassettes/OmniAuth_Strategies_CrewCheck/provides_an_unempty_list_of_teams.yml
|
214
|
+
- spec/spec_helper.rb
|
215
|
+
- spec/support/_dotenv.rb
|
216
|
+
- spec/support/vcr.rb
|
217
|
+
- spec/unit/crew_check/role_determination_spec.rb
|
218
|
+
- spec/unit/crew_check/team_list_spec.rb
|
219
|
+
- spec/unit/crew_check/team_spec.rb
|
220
|
+
- spec/unit/omniauth/strategies/crew_check_spec.rb
|