omnigollum 0.1.4 → 0.1.5

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/Readme.md +1 -1
  3. data/lib/omnigollum.rb +13 -4
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e71dec029dc000cf53c14360c11a05eef251188
4
- data.tar.gz: 174f16d40ad98606bbd574f2381d988d49220496
3
+ metadata.gz: 6396807c5a761a22a4ab521b16f75e6230790d31
4
+ data.tar.gz: 8b4186aeb1b6ffb668d77577abba4e435afe002f
5
5
  SHA512:
6
- metadata.gz: 805e92e761842820825f42ffb31cf741a27ad58a3b806200849f941c5d8587ed14bc97e330600d29dbc057ae8607df7f93ab09ad8c5e8ae9faf12ec37e65480a
7
- data.tar.gz: 1a39c99a8756d102e4623e2d81488ddd4063d9faa3e342a3bc1219e9ba8e004016afaf401ffb81688c21138df8f54f63c1c23e45b77575d56db726686a0f5e15
6
+ metadata.gz: f5d2d3801ee342075fedef2af9a22b8eb61e8fb491314633b997ef6799cf5657d82762a15cd5929ba8976ed5b7fe9a9a891d604843dc45384f0a53d144c063ce
7
+ data.tar.gz: 187c2f407ab69cfe16329cc51ea74be6ab4ca31482008a0465578eb3247a287de9b0cdc313b401fcac99d8236ff81ddff27b4cebb0d25ade6feb85291b800254
data/Readme.md CHANGED
@@ -85,7 +85,7 @@ Precious::App.register Omnigollum::Sinatra
85
85
 
86
86
  ### Gollum
87
87
  You can (optionally) apply the patches here, to get a neat little auth
88
- status widget in the top right corner of the page https://github.com/arr2036/gollum/commit/30857db6ba5a2100c0d392cb0de205e644430d13
88
+ status widget in the top right corner of the page https://github.com/arr2036/gollum/commit/dd1fdad59d9f12bfe637704c0101af96aaa1a7e4
89
89
 
90
90
 
91
91
 
@@ -88,7 +88,7 @@ module Omnigollum
88
88
  origin = '/'
89
89
  end
90
90
 
91
- redirect options[:route_prefix] + '/auth/' + options[:provider_names].first.to_s + "?origin=" +
91
+ redirect (request.script_name || '') + options[:route_prefix] + '/auth/' + options[:provider_names].first.to_s + "?origin=" +
92
92
  CGI.escape(origin)
93
93
  else
94
94
  auth_config
@@ -150,6 +150,7 @@ module Omnigollum
150
150
  :provider_names => [],
151
151
  :authorized_users => [],
152
152
  :author_format => Proc.new { |user| user.nickname ? user.name + ' (' + user.nickname + ')' : user.name },
153
+ :author_email => Proc.new { |user| user.email }
153
154
  }
154
155
 
155
156
  def initialize
@@ -256,9 +257,17 @@ module Omnigollum
256
257
  if !request.env['omniauth.auth'].nil?
257
258
  user = Omnigollum::Models::OmniauthUser.new(request.env['omniauth.auth'], options)
258
259
 
260
+ case (authorized_users = options[:authorized_users])
261
+ when Regexp
262
+ user_authorized = (user.email =~ authorized_users)
263
+ when Array
264
+ user_authorized = authorized_users.include?(user.email) || authorized_users.include?(user.nickname)
265
+ else
266
+ user_authorized = true
267
+ end
268
+
259
269
  # Check authorized users
260
- if !options[:authorized_users].empty? && !options[:authorized_users].include?(user.email) &&
261
- !options[:authorized_users].include?(user.nickname)
270
+ if !user_authorized
262
271
  @title = 'Authorization failed'
263
272
  @subtext = 'User was not found in the authorized users list'
264
273
  @auth_params = "?origin=#{CGI.escape(request.env['omniauth.origin'])}" unless request.env['omniauth.origin'].nil?
@@ -270,7 +279,7 @@ module Omnigollum
270
279
  # Update gollum's author hash, so commits are recorded correctly
271
280
  session['gollum.author'] = {
272
281
  :name => options[:author_format].call(user),
273
- :email => user.email
282
+ :email => options[:author_email].call(user)
274
283
  }
275
284
 
276
285
  redirect request.env['omniauth.origin']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnigollum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arran Cudbard-Bell
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-12 00:00:00.000000000 Z
12
+ date: 2016-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gollum
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
- rubygems_version: 2.0.14
104
+ rubygems_version: 2.0.14.1
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: Omnigollum makes it easy to use OmniAuth with Gollum