Skip to content
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

[Spaces] - Introducing Space Identifier, Forgetting URL Context #21295

Merged
merged 5 commits into from
Jul 27, 2018

Conversation

legrego
Copy link
Member

@legrego legrego commented Jul 26, 2018

From the end-user perspective, this is a simple rebranding of the URL Context.

Internally, the space identifier is now used to represent both the url path of the space, as well as that space's document id in the kibana index.

This provides the following benefits:

  1. Eliminates the need to query ES to determine the active space id.
  2. Prevents two spaces from sharing the same url path, which we had to manually check for in the past
  3. Simplifies using the role management API

As an added bonus, the Space Description is now optional 🎉

@legrego legrego added WIP Work in progress Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! labels Jul 26, 2018
@legrego legrego removed the WIP Work in progress label Jul 26, 2018
@legrego legrego requested a review from kobelb July 26, 2018 19:56
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@@ -39,7 +39,7 @@ export class SpacesSavedObjectsClient {
*/
async create(type, attributes = {}, options = {}) {

const spaceId = await this._getSpaceId();
const spaceId = this._spaceId;
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is 🥇

@@ -244,34 +244,6 @@ export class SpacesSavedObjectsClient {
return await this._client.update(type, id, attributes, updateOptions);
}

async _getSpaceId() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Bye!!!!

let pathToCheck = requestBasePath;

if (serverBasePath && serverBasePath !== '/' && requestBasePath.startsWith(serverBasePath)) {
pathToCheck = requestBasePath.substr(serverBasePath.length);
}
// Look for `/s/space-url-context` in the base path
const matchResult = pathToCheck.match(/^\/s\/([a-z0-9\-]+)/);
const matchResult = pathToCheck.match(/^\/s\/([a-z0-9_\-]+)/);
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we mean to add an _ here? I'm not seeing an _ being allowed in the spaceSchema id.

Copy link
Member Author

Choose a reason for hiding this comment

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

ah yep, that was a partial change that I didn't finish. thanks!

});
});

test('PUT /space should update an exisitng space with the provided ID', async () => {
Copy link
Contributor

@kobelb kobelb Jul 27, 2018

Choose a reason for hiding this comment

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

nit: existing is misspelled.

@@ -173,9 +262,11 @@ describe('Spaces API', () => {
});

test('POST space/{id}/select should respond with the new space location when a baseUrl is provided', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the name of this test (which this PR didn't change) kind of throws me off, because the baseUrl is being pulled from server.config() but the test description made me think it was being grabbed from the payload itself.

@legrego legrego merged commit e526f5b into elastic:spaces-phase-1 Jul 27, 2018
@elasticmachine
Copy link
Contributor

💔 Build Failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants