Skip to content

Commit

Permalink
[backend] add base draftWorkspace
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyCloarec committed Sep 25, 2024
1 parent e4d0be2 commit 2a4a0fa
Show file tree
Hide file tree
Showing 36 changed files with 717 additions and 44 deletions.
2 changes: 2 additions & 0 deletions opencti-platform/opencti-front/lang/back/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"CRL distribution points": "CRL-Verteilungspunkte",
"Csv_mapper_id": "Csv_mapper_id",
"Ctime": "Ctime",
"Current draft context": "Aktueller Entwurfskontext",
"Current state cursor": "Aktueller Status Cursor",
"Current state date": "Aktuelles Statusdatum",
"Current stated date": "Aktuell angegebenes Datum",
Expand Down Expand Up @@ -196,6 +197,7 @@
"Display name": "Name anzeigen",
"DLL service": "DLL-Dienst",
"Do you want to delete this support package?": "Möchten Sie dieses Support-Paket löschen?",
"Draft ids": "Entwurfs-Ids",
"DST": "DST",
"DST byte count": "DST-Byte-Anzahl",
"DST packets": "DST-Pakete",
Expand Down
2 changes: 2 additions & 0 deletions opencti-platform/opencti-front/lang/back/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"CRL distribution points": "CRL distribution points",
"Csv_mapper_id": "Csv_mapper_id",
"Ctime": "Ctime",
"Current draft context": "Current draft context",
"Current state cursor": "Current state cursor",
"Current state date": "Current state date",
"Current stated date": "Current stated date",
Expand Down Expand Up @@ -196,6 +197,7 @@
"Display name": "Display name",
"DLL service": "DLL service",
"Do you want to delete this support package?": "Do you want to delete this support package?",
"Draft ids": "Draft ids",
"DST": "DST",
"DST byte count": "DST byte count",
"DST packets": "DST packets",
Expand Down
2 changes: 2 additions & 0 deletions opencti-platform/opencti-front/lang/back/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"CRL distribution points": "Puntos de distribución CRL",
"Csv_mapper_id": "Csv_mapper_id",
"Ctime": "Ctime",
"Current draft context": "Contexto actual del proyecto",
"Current state cursor": "Cursor de estado actual",
"Current state date": "Fecha de estado actual",
"Current stated date": "Fecha actual",
Expand Down Expand Up @@ -196,6 +197,7 @@
"Display name": "Mostrar nombre",
"DLL service": "Servicio DLL",
"Do you want to delete this support package?": "¿Desea eliminar este paquete de soporte?",
"Draft ids": "Id. de borrador",
"DST": "DST",
"DST byte count": "DST byte count",
"DST packets": "Paquetes DST",
Expand Down
2 changes: 2 additions & 0 deletions opencti-platform/opencti-front/lang/back/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"CRL distribution points": "Points de distribution des LCR",
"Csv_mapper_id": "Csv_mapper_id",
"Ctime": "Ctime",
"Current draft context": "Contexte du projet actuel",
"Current state cursor": "Curseur d'état actuel",
"Current state date": "Date de l'état actuel",
"Current stated date": "Current stated date",
Expand Down Expand Up @@ -196,6 +197,7 @@
"Display name": "Nom d'affichage",
"DLL service": "Service DLL",
"Do you want to delete this support package?": "Voulez-vous supprimer ce paquet de support ?",
"Draft ids": "Idées de projet",
"DST": "DST",
"DST byte count": "Nombre d'octets DST",
"DST packets": "Paquets DST",
Expand Down
2 changes: 2 additions & 0 deletions opencti-platform/opencti-front/lang/back/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"CRL distribution points": "CRL配布ポイント",
"Csv_mapper_id": "Csv_mapper_id",
"Ctime": "Ctime",
"Current draft context": "現在のドラフト状況",
"Current state cursor": "ヘッダー",
"Current state date": "摂取実行",
"Current stated date": "現在の記載日",
Expand Down Expand Up @@ -196,6 +197,7 @@
"Display name": "表示名",
"DLL service": "DLLサービス",
"Do you want to delete this support package?": "このサポートパッケージを削除しますか?",
"Draft ids": "ドラフトID",
"DST": "DST",
"DST byte count": "DST バイト数",
"DST packets": "DSTパケット",
Expand Down
2 changes: 2 additions & 0 deletions opencti-platform/opencti-front/lang/back/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"CRL distribution points": "CRL 배포 지점",
"Csv_mapper_id": "Csv_mapper_id",
"Ctime": "변경 시간",
"Current draft context": "현재 초안 컨텍스트",
"Current state cursor": "현재 상태 커서",
"Current state date": "현재 상태 날짜",
"Current stated date": "현재 명시된 날짜",
Expand Down Expand Up @@ -196,6 +197,7 @@
"Display name": "표시 이름",
"DLL service": "DLL 서비스",
"Do you want to delete this support package?": "이 지원 패키지를 삭제하시겠습니까?",
"Draft ids": "초안 ID",
"DST": "DST",
"DST byte count": "DST 바이트 수",
"DST packets": "DST 패킷",
Expand Down
2 changes: 2 additions & 0 deletions opencti-platform/opencti-front/lang/back/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"CRL distribution points": "CRL 分发点",
"Csv_mapper_id": "Csv_mapper_id",
"Ctime": "Ctime",
"Current draft context": "当前草案背景",
"Current state cursor": "当前状态游标",
"Current state date": "当前状态日期",
"Current stated date": "当前状态日期",
Expand Down Expand Up @@ -196,6 +197,7 @@
"Display name": "显示名称",
"DLL service": "DLL 服务",
"Do you want to delete this support package?": "您想删除此支持包吗?",
"Draft ids": "草案 ID",
"DST": "DST",
"DST byte count": "DST 字节数",
"DST packets": "DST 数据包",
Expand Down
32 changes: 32 additions & 0 deletions opencti-platform/opencti-front/src/schema/relay.schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,7 @@ type MeUser implements BasicObject & InternalObject {
submenu_show_icons: Boolean
submenu_auto_collapse: Boolean
monochrome_labels: Boolean
workspace_context: String
}

type SessionDetail {
Expand Down Expand Up @@ -7849,6 +7850,9 @@ type Query {
deleteOperations(first: Int, after: ID, orderBy: DeleteOperationOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String): DeleteOperationConnection
supportPackage(id: String!): SupportPackage
supportPackages(first: Int, after: ID, orderBy: SupportPackageOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String): SupportPackageConnection
draftWorkspace(id: String!): DraftWorkspace
draftWorkspaces(first: Int, after: ID, orderBy: DraftWorkspacesOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String): DraftWorkspaceConnection
draftWorkspaceEntities(types: [String], first: Int, after: ID, orderBy: StixDomainObjectsOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String): StixCoreObjectConnection
}

type Subscription {
Expand Down Expand Up @@ -8660,6 +8664,8 @@ type Mutation {
supportPackageAdd(input: SupportPackageAddInput!): SupportPackage
supportPackageForceZip(input: SupportPackageForceZipInput!): SupportPackage
supportPackageDelete(id: ID!): ID
draftWorkspaceAdd(input: DraftWorkspaceAddInput!): DraftWorkspace
draftWorkspaceDelete(id: ID!): ID
}

type Channel implements BasicObject & StixObject & StixCoreObject & StixDomainObject {
Expand Down Expand Up @@ -11922,4 +11928,30 @@ input SupportPackageAddInput {

input SupportPackageForceZipInput {
id: String!
}

type DraftWorkspace implements InternalObject & BasicObject {
id: ID!
entity_type: String!
standard_id: String!
parent_types: [String!]!
name: String!
}

enum DraftWorkspacesOrdering {
name
}

type DraftWorkspaceConnection {
pageInfo: PageInfo!
edges: [DraftWorkspaceEdge!]!
}

type DraftWorkspaceEdge {
cursor: String!
node: DraftWorkspace!
}

input DraftWorkspaceAddInput {
name: String!
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import useAuth from './useAuth';

const ignoredAttributes = [
'id',
'draft_ids',
'parent_types',
'base_type',
'internal_id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ test('Add and remove observable from Observables tab of a Report as Admin user',
await expect(containerObservablesPage.getPage()).toBeVisible();
await containerObservablesPage.getAddObservableListButton().click();
await containerAddObservablesPage.createNewIPV4Observable('8.8.8.8');
await page.getByRole('textbox', { name: 'Search these results...' }).click();
await page.getByRole('textbox', { name: 'Search these results...' }).pressSequentially('8.8.8.8', { delay: 100 });
await page.getByRole('textbox', { name: 'Search these results...' }).press('Enter');
await expect(containerAddObservablesPage.getObservable('IPv4 address 8.8.8.8')).toBeVisible();
await containerAddObservablesPage.getObservable('IPv4 address 8.8.8.8').click();
await containerAddObservablesPage.getCloseObservablesListButton().click();
Expand Down Expand Up @@ -164,6 +167,7 @@ test.describe('Add and remove observable from Observables tab of a Report as noB
const containerAddObservablesPage = new ContainerAddObservablesPage(page);
const commitMessagePage = new CommitMessagePage(page);
const leftBarPage = new LeftBarPage(page);
const search = new SearchPageModel(page);

// Create a report and check that adding an observable is possible
await reportPage.goto();
Expand All @@ -177,14 +181,16 @@ test.describe('Add and remove observable from Observables tab of a Report as noB
await expect(containerObservablesPage.getPage()).toBeVisible();
await containerObservablesPage.getAddObservableListButton().click();
await containerAddObservablesPage.createNewIPV4Observable('9.9.9.9');
await page.getByRole('textbox', { name: 'Search these results...' }).click();
await page.getByRole('textbox', { name: 'Search these results...' }).pressSequentially('9.9.9.9', { delay: 100 });
await page.getByRole('textbox', { name: 'Search these results...' }).press('Enter');
await expect(containerAddObservablesPage.getObservable('IPv4 address 9.9.9.9')).toBeVisible();
await containerAddObservablesPage.getObservable('IPv4 address 9.9.9.9').click();
await containerAddObservablesPage.getCloseObservablesListButton().click();
await expect(containerObservablesPage.getObservableInContainer('IPv4 address 9.9.9.9')).toBeVisible();

// Enable report references and check that removing observable asks for an external reference
await leftBarPage.clickOnMenu('Settings', 'Customization');
const search = new SearchPageModel(page);
await search.addSearch('report');
await page.getByRole('link', { name: 'Report' }).click();
await page.locator('span').filter({ hasText: 'Enforce references' }).click();
Expand Down
3 changes: 2 additions & 1 deletion opencti-platform/opencti-graphql/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"NEW_IMPORT_SCREENS",
"FILIGRAN_LOADER",
"CONTAINERS_AUTHORIZED_MEMBERS",
"TELEMETRY_COUNT_ACTIVE_USERS"
"TELEMETRY_COUNT_ACTIVE_USERS",
"DRAFT_WORKSPACE"
],
"https_cert": {
"ca": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,7 @@ type MeUser implements BasicObject & InternalObject {
submenu_show_icons: Boolean
submenu_auto_collapse: Boolean
monochrome_labels: Boolean
workspace_context: String
}
type SessionDetail {
id: ID!
Expand Down
Loading

0 comments on commit 2a4a0fa

Please sign in to comment.