Permalink
Browse files

team auth only requires user scope now

  • Loading branch information...
1 parent af7e302 commit 308027ec015a2f35bdc27991fd41cc9ffa72b734 @atmos committed May 30, 2012
Showing with 13 additions and 8 deletions.
  1. +1 −1 lib/sinatra/auth/github/version.rb
  2. +1 −1 sinatra_auth_github.gemspec
  3. +11 −6 spec/app.rb
@@ -1,7 +1,7 @@
module Sinatra
module Auth
module Github
- VERSION = "0.5.3"
+ VERSION = "0.5.4"
end
end
end
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.add_dependency "sinatra", "~>1.0"
s.add_dependency "yajl-ruby", "~>1.1"
s.add_dependency "rest-client", "~>1.6.1"
- s.add_dependency "warden-github", "~>0.4.4"
+ s.add_dependency "warden-github", "~>0.5.0"
s.add_development_dependency "rake"
s.add_development_dependency "rspec", "~>2.0.0"
View
@@ -6,6 +6,7 @@ class App < Sinatra::Base
enable :sessions
set :github_options, {
+ :scopes => "user",
:secret => ENV['GITHUB_CLIENT_SECRET'],
:client_id => ENV['GITHUB_CLIENT_ID'],
}
@@ -24,15 +25,19 @@ def repos
end
get '/orgs/:id' do
- github_public_organization_authenticate!(params['id'])
+ github_organization_authenticate!(params['id'])
"Hello There, #{github_user.name}! You have access to the #{params['id']} organization."
end
- # the scopes above need to include repo for team access :(
- # get '/teams/:id' do
- # github_team_authenticate!(params['id'])
- # "Hello There, #{github_user.name}! You have access to the #{params['id']} team."
- # end
+ get '/publicized_orgs/:id' do
+ github_publicized_organization_authenticate!(params['id'])
+ "Hello There, #{github_user.name}! You are publicly a member of the #{params['id']} organization."
+ end
+
+ get '/teams/:id' do
+ github_team_authenticate!(params['id'])
+ "Hello There, #{github_user.name}! You have access to the #{params['id']} team."
+ end
get '/logout' do
logout!

0 comments on commit 308027e

Please sign in to comment.