omnigollum 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +1 -1
- data/lib/omnigollum.rb +13 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6396807c5a761a22a4ab521b16f75e6230790d31
|
4
|
+
data.tar.gz: 8b4186aeb1b6ffb668d77577abba4e435afe002f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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/
|
88
|
+
status widget in the top right corner of the page https://github.com/arr2036/gollum/commit/dd1fdad59d9f12bfe637704c0101af96aaa1a7e4
|
89
89
|
|
90
90
|
|
91
91
|
|
data/lib/omnigollum.rb
CHANGED
@@ -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 !
|
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
|
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
|
+
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:
|
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
|