warden-github 0.13.2 → 0.14.0
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/Gemfile +2 -2
- data/{LICENSE → LICENSE.md} +1 -1
- data/README.md +7 -0
- data/example/simple_app.rb +2 -0
- data/lib/warden/github/user.rb +8 -1
- data/lib/warden/github/version.rb +1 -1
- metadata +3 -3
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
|
3
|
+
gem 'debugger', :platforms => :ruby_19, :require => false
|
4
4
|
gem 'ruby-debug', :platforms => :ruby_18, :require => false
|
5
5
|
|
6
6
|
# Specify your gem's dependencies in warden-github.gemspec
|
data/{LICENSE → LICENSE.md}
RENAMED
data/README.md
CHANGED
@@ -130,6 +130,13 @@ user.api # => Authenticated Octokit::Client for the user.
|
|
130
130
|
|
131
131
|
For more information on API access, refer to the [octokit documentation](http://rdoc.info/gems/octokit).
|
132
132
|
|
133
|
+
## Framework Adapters
|
134
|
+
|
135
|
+
If you're looking for an easy way to integrate this into a Sinatra or Rails application, take a look at the following gems:
|
136
|
+
|
137
|
+
- [sinatra_auth_github](https://github.com/atmos/sinatra_auth_github)
|
138
|
+
- [warden-github-rails](https://github.com/fphilipe/warden-github-rails)
|
139
|
+
|
133
140
|
## Additional Information
|
134
141
|
|
135
142
|
- [warden](https://github.com/hassox/warden)
|
data/example/simple_app.rb
CHANGED
@@ -82,4 +82,6 @@ __END__
|
|
82
82
|
<dd><%= env['warden'].user.organization_public_member?('rails') %></dd>
|
83
83
|
<dt>Rails Committer Team Member:</dt>
|
84
84
|
<dd><%= env['warden'].user.team_member?(632) %></dd>
|
85
|
+
<dt>GitHub Site Admin:</dt>
|
86
|
+
<dd><%= env['warden'].user.site_admin? %></dd>
|
85
87
|
</dl>
|
data/lib/warden/github/user.rb
CHANGED
@@ -3,7 +3,7 @@ require 'octokit'
|
|
3
3
|
module Warden
|
4
4
|
module GitHub
|
5
5
|
class User < Struct.new(:attribs, :token)
|
6
|
-
ATTRIBUTES = %w[id login name gravatar_id email company].freeze
|
6
|
+
ATTRIBUTES = %w[id login name gravatar_id email company site_admin].freeze
|
7
7
|
|
8
8
|
def self.load(access_token)
|
9
9
|
api = Octokit::Client.new(:oauth_token => access_token)
|
@@ -71,6 +71,13 @@ module Warden
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
+
# Identify GitHub employees/staff members.
|
75
|
+
#
|
76
|
+
# Returns: true if the authenticated user is a GitHub employee, false otherwise
|
77
|
+
def site_admin?
|
78
|
+
site_admin || false
|
79
|
+
end
|
80
|
+
|
74
81
|
# Access the GitHub API from Octokit
|
75
82
|
#
|
76
83
|
# Octokit is a robust client library for the GitHub API
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warden-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.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: 2013-
|
12
|
+
date: 2013-04-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: warden
|
@@ -214,7 +214,7 @@ files:
|
|
214
214
|
- .rspec
|
215
215
|
- .travis.yml
|
216
216
|
- Gemfile
|
217
|
-
- LICENSE
|
217
|
+
- LICENSE.md
|
218
218
|
- README.md
|
219
219
|
- Rakefile
|
220
220
|
- config.ru
|