This repository has been archived by the owner on Dec 8, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Add guest user capability #3
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
95193a4
Hide SSI auth include directive in public mode
953bbd2
Convert joiner_test.rb to Minitest
385480e
Import guest users from _data/private/hub
64371f0
Move DummyTestPage into separate module
80aa39b
Generate auth artifacts for guest users
8195583
Pull upstream changes into _data/private
b0ef1bb
Remove unnecessary explicit truth check
07f2957
Improve generate_user_authentication_include() doc
69a1a51
More generate_user_authentication_include() detail
4bdd9bf
Replace $REMOTE_USER with $http_x_forwarded_email
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule private
updated
from dfea77 to 9c7fe7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div class="auth-include"> | ||
<span>{{ page.user.full_name }}</span> | ||
<img src="{{ site.baseurl }}/{{ site.team_img_dir }}/{{ site.guest_user_img }}"> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<div class="team-member-auth-include"> | ||
<a href="{{ site.baseurl }}/team/{{ page.member.name }}"><span>{{ page.member.full_name }}</span> | ||
<img class="team-member-thumb" src="{{ site.baseurl }}/{{ page.member.image }}"></a> | ||
<div class="auth-include"> | ||
<a href="{{ site.baseurl }}/team/{{ page.user.name }}"><span>{{ page.user.full_name }}</span> | ||
<img src="{{ site.baseurl }}/{{ page.user.image }}"></a> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
require_relative "../_plugins/auth" | ||
require_relative "page" | ||
|
||
require "jekyll" | ||
require "jekyll/site" | ||
require "minitest/autorun" | ||
|
||
module Hub | ||
class AuthTest < ::Minitest::Test | ||
def setup | ||
@site = ::Jekyll::Site.new ::Jekyll::Configuration::DEFAULTS | ||
|
||
@team = { | ||
'mbland' => { | ||
'email' => 'michael.bland@gsa.gov', | ||
'full_name' => 'Mike Bland'}, | ||
'foobar' => { | ||
'email' => 'foo.bar@notgsa.gov', | ||
'full_name' => 'Foo Bar'}, | ||
} | ||
|
||
@guests = [ | ||
{'email' => 'mbland@acm.org', | ||
'full_name' => 'Mike Bland'}, | ||
{'email' => 'baz.quux@notgsa.gov', | ||
'full_name' => 'Baz Quux'}, | ||
] | ||
end | ||
|
||
def actual_auth_include_users | ||
unless @site.pages.empty? | ||
@site.pages[0..-2].map {|page| page['user']} | ||
else | ||
[] | ||
end | ||
end | ||
|
||
def actual_auth_emails | ||
unless @site.pages.empty? | ||
@site.pages.last['addrs'] | ||
else | ||
[] | ||
end | ||
end | ||
|
||
def test_empty_team_and_guests | ||
@site.data['team'] = {} | ||
@site.data['guest_users'] = [] | ||
Auth.generate_artifacts @site | ||
|
||
assert_empty actual_auth_include_users | ||
assert_empty actual_auth_emails | ||
end | ||
|
||
def test_no_artifacts_in_public_mode | ||
@site.data['team'] = @team | ||
@site.data['guest_users'] = @guests | ||
@site.config['public'] = true | ||
Auth.generate_artifacts @site | ||
|
||
assert_empty actual_auth_include_users | ||
assert_empty actual_auth_emails | ||
end | ||
|
||
def test_team_artifacts_generated | ||
@site.data['team'] = @team | ||
Auth.generate_artifacts @site | ||
|
||
assert_equal( | ||
[@team['mbland'], @team['foobar']], | ||
actual_auth_include_users) | ||
assert_equal( | ||
['foo.bar@notgsa.gov', 'michael.bland@gsa.gov'], | ||
actual_auth_emails) | ||
end | ||
|
||
def test_guest_artifacts_generated | ||
@site.data['team'] = {} | ||
@site.data['guest_users'] = @guests | ||
Auth.generate_artifacts @site | ||
|
||
assert_equal( | ||
[@guests[0], @guests[1]], | ||
actual_auth_include_users) | ||
assert_equal( | ||
['baz.quux@notgsa.gov', 'mbland@acm.org'], | ||
actual_auth_emails) | ||
end | ||
|
||
def test_team_and_guest_artifacts_generated | ||
@site.data['team'] = @team | ||
@site.data['guest_users'] = @guests | ||
Auth.generate_artifacts @site | ||
|
||
assert_equal( | ||
[@team['mbland'], @team['foobar'], @guests[0], @guests[1]], | ||
actual_auth_include_users) | ||
assert_equal( | ||
['baz.quux@notgsa.gov', 'foo.bar@notgsa.gov', | ||
'mbland@acm.org', 'michael.bland@gsa.gov'], | ||
actual_auth_emails) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require "jekyll" | ||
require "jekyll/page" | ||
|
||
module Hub | ||
class DummyTestPage < ::Jekyll::Page | ||
def initialize(site, dir, filename) | ||
@site = site | ||
@base = 'fake_test_basedir' | ||
@dir = dir | ||
@name = filename | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ruby convention is rely on truthiness, unless there's some reason to explicitly check for the boolean value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know why I did that. Fixed.