Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Update GitHub Auth Backend #78

Merged
merged 9 commits into from
Mar 29, 2017
Merged

Update GitHub Auth Backend #78

merged 9 commits into from
Mar 29, 2017

Conversation

djenriquez
Copy link
Owner

This PR brings the GitHub auth backend configuration to parity with the rest of auth backends.

@djenriquez
Copy link
Owner Author

@msessa @Lucretius @alexunwin PTAL

@djenriquez djenriquez changed the title Update GitHub auth backend Update GitHub Auth Backend Mar 28, 2017
// Misc
import _ from 'lodash';
import update from 'immutability-helper';
import Avatar from 'material-ui/Avatar';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you separate by comments but this is material ui

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

import VaultObjectDeleter from '../../shared/DeleteObject/DeleteObject.jsx'

function snackBarMessage(message) {
let ev = new CustomEvent("snackbar", { detail: { message: message } });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no point in declaring a var here

base_url: undefined,
max_ttl: undefined,
ttl: undefined
}
Copy link
Collaborator

@alexunwin alexunwin Mar 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this? set defaults from a config or put some defaults here. No need to make undefined as that is the default behavior of not existing.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's documentation. Reference for the immutability helper on what properties this object should actually contain.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Schema should be kept separate

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only there to mirror Vault's schema for the config object. Vault-UI doesn't dictate any new schema.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, it only exists and is only valid for the scope of this code.

if (error.response.status !== 404) {
snackBarMessage(error);
} else {
this.setState({ teams: [] });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if this is a different status code?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it will display the error out in the snack bar, 404 is a specific exception which in this case means the config hasn't been initialized

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So 500?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in this case, Vault has some predefined return codes for its restful API. 404s are returned in this case and is the only status we need to handle.

this.setState({ users: _.valuesIn(users) });
})
.catch((error) => {
if (error.response.status !== 404) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again here.. 404 is limiting

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I only want to handle 404s =P

let policies = this.state.policies;
render() {
let renderListItems = () => {
let items = this.state.selectedTab === "team" ? this.state.teams : this.state.users;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double quotes...get that es-lintrc plugin

tooltip="Delete"
onTouchTap={() => this.setState({ deleteUserPath: `${this.state.baseVaultPath}/map/${this.state.selectedTab}s/${item}` })}
>
{window.localStorage.getItem("showDeleteModal") === 'false' ? <ActionDeleteForever color={red500} /> : <ActionDelete color={red500} />}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use falsy here?

Copy link
Owner Author

@djenriquez djenriquez Mar 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value we're comparing to is of type string, so we can't use a falsy in this case.

<List>
<Subheader>Assigned Policies</Subheader>
<PolicyPicker
height="250px"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

css...no?

/>
<Subheader>Assigned Policies</Subheader>
<PolicyPicker
height="250px"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

css?

this.setState({ newConfig: update(this.state.newConfig, { ttl: { $set: e.target.value } }) });
}}
/>
<div style={{ paddingTop: '20px', textAlign: 'center' }}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

css...should not be hardcoded. is there a reason?

@alexunwin
Copy link
Collaborator

ran changes locally... 👍 for functionality. Some minor stuff

@djenriquez djenriquez merged commit b7b8adc into master Mar 29, 2017
@djenriquez djenriquez deleted the feature/update-github branch March 29, 2017 03:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants