-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support disabling Auth0 #967
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7ffbd44
support disabling `AUTH0_DISABLED`
miles-grant-ibigroup fd85a0e
refactor(LocalUserRetriever): Provide local user info for non-auth co…
binh-dam-ibigroup dee0615
refactor(PublicHeader): Hide logout button on non-auth configs
binh-dam-ibigroup 617833a
refactor(UserButtons): Hide logout button on non-auth configs
binh-dam-ibigroup 3954164
refactor(UserAccount): Hide most user account content on non-auth con…
binh-dam-ibigroup a895298
refactor(LocalUserRetriever): Use same email as backend.
binh-dam-ibigroup 398d8f9
refactor(AdminPage): Hide user list on non-auth configs
binh-dam-ibigroup a67add3
refactor(ApplicationStatus): Hide Auth0 link on non-auth configs
binh-dam-ibigroup 184dbbf
refactor(WatchButton): Hide watch button on no-auth configs
binh-dam-ibigroup 6ad320a
refactor(wrapComponentInAuthStrategy): Relax some admin checks.
binh-dam-ibigroup 8b56c67
refactor(editor/util/ui.js): Revert unneeded changes.
binh-dam-ibigroup cf1471d
refactor(manager/util/index): Only check user perms for enabling edit…
binh-dam-ibigroup 62d2dad
refactor(FeedSourceTable): Evaluate admin only using user perms.
binh-dam-ibigroup 6ff7aa3
refactor(manager/components): Use user perms for enabling features.
binh-dam-ibigroup 6f9c156
refactor(manager/actions): Enable features using users perms only.
binh-dam-ibigroup 46f2f90
test(ActiveProjectViewer): Update snapshots
binh-dam-ibigroup 5b4aa34
refactor(UserButtons): Reinstate original urls.
binh-dam-ibigroup 969af57
improvement(UserHomePage): Add info message if auth is disabled.
binh-dam-ibigroup 9fac323
style: Sort imports and fix typos.
binh-dam-ibigroup 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
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
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
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,60 @@ | ||
// @flow | ||
// $FlowFixMe useEffect not recognized by flow. | ||
import { useEffect } from 'react' | ||
import { connect } from 'react-redux' | ||
|
||
import * as userActions from '../../manager/actions/user' | ||
import { AUTH0_CLIENT_ID } from '../constants' | ||
|
||
type Props = { | ||
receiveTokenAndProfile: typeof userActions.receiveTokenAndProfile | ||
} | ||
|
||
const profile = { | ||
app_metadata: { | ||
'datatools': [ | ||
{ | ||
'permissions': [ | ||
{ | ||
'type': 'administer-application' | ||
} | ||
], | ||
'projects': [], | ||
'client_id': AUTH0_CLIENT_ID, | ||
'subscriptions': [] | ||
} | ||
], | ||
'roles': [ | ||
'user' | ||
] | ||
}, | ||
// FIXME: pick a better email address for both backend and frontend. | ||
email: '[email protected]', | ||
name: 'localuser', | ||
nickname: 'Local User', | ||
picture: 'https://d2tyb7byn1fef9.cloudfront.net/ibi_group_black-512x512.png', | ||
sub: 'localuser', | ||
user_id: 'localuser', | ||
user_metadata: {} | ||
} | ||
|
||
const token = 'local-user-token' | ||
|
||
/** | ||
* This component provides a user profile for configs without authentication. | ||
*/ | ||
const LocalUserRetriever = ({ receiveTokenAndProfile }: Props) => { | ||
// Update the user info in the redux state on initialization. | ||
useEffect(() => { | ||
receiveTokenAndProfile({ profile, token }) | ||
}, []) | ||
|
||
// Component renders nothing. | ||
return null | ||
} | ||
|
||
const mapDispatchToProps = { | ||
receiveTokenAndProfile: userActions.receiveTokenAndProfile | ||
} | ||
|
||
export default connect(null, mapDispatchToProps)(LocalUserRetriever) |
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
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
Oops, something went wrong.
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.
Are you looking for a real email address here or just a different fake/placeholder one?
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.
Probably a different one. This email address appears in the Notes section of each feed.