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

[Workspace][Feature] Add ACL related functions #5084

Merged
merged 38 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
46323e7
[Workspace] Add ACL related functions for workspace (#146)
gaobinlong Sep 14, 2023
20d12cf
Modify changelog
gaobinlong Sep 21, 2023
b025788
Add more unit test cases
gaobinlong Sep 21, 2023
ab08ab9
Modify test case
gaobinlong Sep 21, 2023
c180e87
Some minor change
gaobinlong Sep 22, 2023
cb0e6b0
Add more test cases
gaobinlong Sep 22, 2023
9a0586d
Merge branch 'main' into acl
joshuarrrr Sep 23, 2023
369e7ec
Optimize some code and the comments of the functions
gaobinlong Oct 2, 2023
3022b5d
Merge remote-tracking branch 'upstream/main' into acl
gaobinlong Oct 2, 2023
1f7ce1a
Add more comments for some basic functions
gaobinlong Oct 2, 2023
c91c061
Merge remote-tracking branch 'upstream/main' into acl
gaobinlong Oct 3, 2023
cad9cdf
Export more interfaces
gaobinlong Oct 3, 2023
c866b80
Merge branch 'main' into acl
joshuarrrr Oct 3, 2023
01da891
merge upstream main
gaobinlong Oct 7, 2023
6b3e3a1
consume permissions in repository
SuZhou-Joe Oct 8, 2023
fb47a13
feat: consume permissions in serializer
SuZhou-Joe Oct 8, 2023
ffedcb4
Add unit tests for consuming permissions in repository
gaobinlong Oct 9, 2023
b9de211
Merge remote-tracking branch 'upstream/main' into acl
gaobinlong Oct 17, 2023
9b31d17
Remove double exclamation
gaobinlong Oct 17, 2023
0347e62
Rename some variables
gaobinlong Oct 17, 2023
3db8adc
merge main
gaobinlong Feb 26, 2024
f042dd1
Merge remote-tracking branch 'upstream/main' into acl
gaobinlong Feb 27, 2024
d52ebaa
Merge branch 'main' into acl
gaobinlong Feb 27, 2024
9787ff1
Remove duplicated semicolon
gaobinlong Feb 29, 2024
db34803
Merge remote-tracking branch 'upstream/main' into acl
gaobinlong Feb 29, 2024
04fcc8f
Add permissions field to the mapping only if the permission control i…
gaobinlong Feb 29, 2024
8b72ba1
Fix test failure
gaobinlong Feb 29, 2024
bc18907
Add feature flag config to the yml file
gaobinlong Mar 1, 2024
a0b062f
Merge remote-tracking branch 'upstream/main' into acl
gaobinlong Mar 1, 2024
9eab96b
Make the comment of feature flag more clear
gaobinlong Mar 1, 2024
281f3a3
Make comment more clear
gaobinlong Mar 1, 2024
5488d12
Remove management permission type
gaobinlong Mar 4, 2024
a29f248
Merge main
gaobinlong Mar 4, 2024
c9056de
Fix test failure
gaobinlong Mar 4, 2024
a951c48
Merge remote-tracking branch 'upstream/main' into acl
gaobinlong Mar 4, 2024
2ed6365
Merge remote-tracking branch 'upstream/main' into acl
gaobinlong Mar 4, 2024
8b014ff
Merge remote-tracking branch 'upstream/main' into acl
gaobinlong Mar 5, 2024
b80101a
Merge remote-tracking branch 'upstream/main' into acl
gaobinlong Mar 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Adds Data explorer framework and implements Discover using it ([#4806](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4806))
- [Theme] Use themes' definitions to render the initial view ([#4936](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4936))
- [Theme] Make `next` theme the default ([#4854](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4854))
- [Workspace] Add ACL related functions ([#5084](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5084/))
gaobinlong marked this conversation as resolved.
Show resolved Hide resolved
- [Discover] Update embeddable for saved searches ([#5081](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5081))
- [Workspace] Add core workspace service module to enable the implementation of workspace features within OSD plugins ([#5092](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5092))

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import crypto from 'crypto';
import { cloneDeep, mapValues } from 'lodash';
import {
IndexMapping,
SavedObjectsFieldMapping,
SavedObjectsMappingProperties,
SavedObjectsTypeMappingDefinitions,
} from './../../mappings';
Expand Down Expand Up @@ -137,6 +138,16 @@ function findChangedProp(actual: any, expected: any) {
* @returns {IndexMapping}
*/
function defaultMapping(): IndexMapping {
const principals: SavedObjectsFieldMapping = {
properties: {
users: {
type: 'keyword',
},
groups: {
type: 'keyword',
},
},
};
return {
dynamic: 'strict',
properties: {
Expand Down Expand Up @@ -175,6 +186,15 @@ function defaultMapping(): IndexMapping {
},
},
},
permissions: {
properties: {
read: principals,
write: principals,
management: principals,
library_read: principals,
library_write: principals,
gaobinlong marked this conversation as resolved.
Show resolved Hide resolved
},
},
},
};
}
Expand Down
105 changes: 105 additions & 0 deletions src/core/server/saved_objects/migrations/core/index_migrator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ describe('IndexMigrator', () => {
namespace: '2f4316de49999235636386fe51dc06c1',
namespaces: '2f4316de49999235636386fe51dc06c1',
originId: '2f4316de49999235636386fe51dc06c1',
permissions: '07c04cdd060494956fdddaa7ef86e8ac',
references: '7997cf5a56cc02bdc9c93361bde732b0',
type: '2f4316de49999235636386fe51dc06c1',
updated_at: '00da57df13e94e9d98437d13ace4bfe0',
Expand All @@ -92,6 +93,40 @@ describe('IndexMigrator', () => {
originId: { type: 'keyword' },
type: { type: 'keyword' },
updated_at: { type: 'date' },
permissions: {
properties: {
library_read: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
library_write: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
management: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
read: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
write: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
},
},
references: {
type: 'nested',
properties: {
Expand Down Expand Up @@ -196,6 +231,7 @@ describe('IndexMigrator', () => {
namespace: '2f4316de49999235636386fe51dc06c1',
namespaces: '2f4316de49999235636386fe51dc06c1',
originId: '2f4316de49999235636386fe51dc06c1',
permissions: '07c04cdd060494956fdddaa7ef86e8ac',
references: '7997cf5a56cc02bdc9c93361bde732b0',
type: '2f4316de49999235636386fe51dc06c1',
updated_at: '00da57df13e94e9d98437d13ace4bfe0',
Expand All @@ -210,6 +246,40 @@ describe('IndexMigrator', () => {
originId: { type: 'keyword' },
type: { type: 'keyword' },
updated_at: { type: 'date' },
permissions: {
properties: {
library_read: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
library_write: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
management: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
read: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
write: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
},
},
references: {
type: 'nested',
properties: {
Expand Down Expand Up @@ -257,6 +327,7 @@ describe('IndexMigrator', () => {
namespace: '2f4316de49999235636386fe51dc06c1',
namespaces: '2f4316de49999235636386fe51dc06c1',
originId: '2f4316de49999235636386fe51dc06c1',
permissions: '07c04cdd060494956fdddaa7ef86e8ac',
references: '7997cf5a56cc02bdc9c93361bde732b0',
type: '2f4316de49999235636386fe51dc06c1',
updated_at: '00da57df13e94e9d98437d13ace4bfe0',
Expand All @@ -271,6 +342,40 @@ describe('IndexMigrator', () => {
originId: { type: 'keyword' },
type: { type: 'keyword' },
updated_at: { type: 'date' },
permissions: {
properties: {
library_read: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
library_write: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
management: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
read: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
write: {
properties: {
users: { type: 'keyword' },
groups: { type: 'keyword' },
},
},
},
},
references: {
type: 'nested',
properties: {
Expand Down
Loading
Loading