Skip to content

Commit

Permalink
[backend/frontend] Save authorized members activation date (#4961)
Browse files Browse the repository at this point in the history
Co-authored-by: Celine Sebe <celine.sebe@filigran.io>
  • Loading branch information
marieflorescontact and CelineSebe authored Jan 10, 2025
1 parent fb7a3e2 commit 5585997
Show file tree
Hide file tree
Showing 34 changed files with 114 additions and 13 deletions.
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/back/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"Authorize to new markings": "Neue Markierungen zulassen",
"Authorized authorities": "Autorisierte Behörden",
"Authorized members": "Autorisierte Mitglieder",
"Authorized members activation date": "Aktivierungsdatum der autorisierten Mitglieder",
"Authors": "Autoren",
"Auto": "Auto",
"Auto collapse submenus": "Untermenüs automatisch ausklappen",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/back/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"Authorize to new markings": "Authorize to new markings",
"Authorized authorities": "Authorized authorities",
"Authorized members": "Authorized members",
"Authorized members activation date": "Authorized members activation date",
"Authors": "Authors",
"Auto": "Auto",
"Auto collapse submenus": "Auto collapse submenus",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/back/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"Authorize to new markings": "Autorizar a nuevas marcas",
"Authorized authorities": "Autoridades autorizadas",
"Authorized members": "Miembros autorizados",
"Authorized members activation date": "Fecha de activación de los miembros autorizados",
"Authors": "Autores",
"Auto": "Auto",
"Auto collapse submenus": "Submenús de colapso automático",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/back/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"Authorize to new markings": "Autoriser les nouveaux marquages",
"Authorized authorities": "Autorités autorisées",
"Authorized members": "Membres autorisés",
"Authorized members activation date": "Date d'activation des membres autorisés",
"Authors": "Auteurs",
"Auto": "Auto",
"Auto collapse submenus": "Réduire automatiquement les sous-menus",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/back/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"Authorize to new markings": "新しいマーキングへの許可",
"Authorized authorities": "付与可能なグループ",
"Authorized members": "許可されたメンバー",
"Authorized members activation date": "公認メンバーのアクティベーション日",
"Authors": "作成者",
"Auto": "オート",
"Auto collapse submenus": "サブメニューの自動折りたたみ",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/back/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"Authorize to new markings": "새 마킹에 대한 권한 부여",
"Authorized authorities": "승인된 권한",
"Authorized members": "승인된 멤버",
"Authorized members activation date": "인증된 회원 활성화 날짜",
"Authors": "작성자",
"Auto": "자동",
"Auto collapse submenus": "서브메뉴 자동 축소",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/back/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"Authorize to new markings": "授权新标记",
"Authorized authorities": "授权机构",
"Authorized members": "授权成员",
"Authorized members activation date": "授权成员激活日期",
"Authors": "作者",
"Auto": "自动",
"Auto collapse submenus": "自动折叠子菜单",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,7 @@
"Restricted": "Eingeschränkt",
"Restricted entities": "Eingeschränkte Einheiten",
"Restriction": "Einschränkung",
"Restriction Date": "Einschränkung Datum",
"Result": "Ergebnis",
"Result Name": "Ergebnis Name",
"Result_name": "Ergebnis_name",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,7 @@
"Restricted": "Restricted",
"Restricted entities": "Restricted entities",
"Restriction": "Restriction",
"Restriction Date": "Restriction Date",
"Result": "Result",
"Result Name": "Result Name",
"Result_name": "Result_name",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,7 @@
"Restricted": "Restringido",
"Restricted entities": "Entidades restringidas",
"Restriction": "Restricción",
"Restriction Date": "Fecha de restricción",
"Result": "Resultados",
"Result Name": "Nombre del resultado",
"Result_name": "Nombre del resultado",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,7 @@
"Restricted": "Restreint",
"Restricted entities": "Entités restreintes",
"Restriction": "Restriction",
"Restriction Date": "Date de restriction",
"Result": "Résultat",
"Result Name": "Nom du résultat",
"Result_name": "Nom du résultat",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,7 @@
"Restricted": "制限",
"Restricted entities": "制限のある団体",
"Restriction": "制限",
"Restriction Date": "制限日",
"Result": "結果",
"Result Name": "結果名",
"Result_name": "結果名",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,7 @@
"Restricted": "제한됨",
"Restricted entities": "제한된 법인",
"Restriction": "제한 사항",
"Restriction Date": "제한 날짜",
"Result": "결과",
"Result Name": "결과 이름",
"Result_name": "결과 이름",
Expand Down
1 change: 1 addition & 0 deletions opencti-platform/opencti-front/lang/front/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,7 @@
"Restricted": "限制",
"Restricted entities": "受限实体",
"Restriction": "限制",
"Restriction Date": "限制日期",
"Result": "结果",
"Result Name": "结果名称",
"Result_name": "结果名称",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ const defaultColumns: DataTableProps['dataColumns'] = {
);
},
},
authorized_members_activation_date: {
id: 'authorized_members_activation_date',
label: 'Restriction Date',
isSortable: true,
render: ({ authorized_members_activation_date }, helpers) => defaultRender(helpers.fd(authorized_members_activation_date)),
},
attribute_abstract: {
id: 'attribute_abstract',
label: 'Abstract',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ const managementDefinitionLineFragment = graphql`
name
}
}
... on Container {
authorized_members_activation_date
}
objectMarking {
id
definition_type
Expand All @@ -65,11 +68,11 @@ const managementDefinitionLineFragment = graphql`
created
modified
}
objectLabel {
id
value
color
}
objectLabel {
id
value
color
}
creators {
id
name
Expand Down Expand Up @@ -159,7 +162,7 @@ const Management = () => {

const dataColumns = {
entity_type: {
percentWidth: 20,
percentWidth: 10,
isSortable: true,
},
name: {
Expand All @@ -179,6 +182,9 @@ const Management = () => {
created_at: {
percentWidth: 20,
},
authorized_members_activation_date: {
percentWidth: 10,
},
objectMarking: {
percentWidth: 10,
isSortable: isRuntimeSort,
Expand Down
12 changes: 12 additions & 0 deletions opencti-platform/opencti-front/src/schema/relay.schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2854,6 +2854,7 @@ interface Container {
objectAssignee: [Assignee!]
avatar: OpenCtiFile
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(first: Int, after: ID, orderBy: StixObjectOrStixRelationshipsOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], all: Boolean): StixObjectOrStixRelationshipRefConnection
relatedContainers(first: Int, after: ID, orderBy: ContainersOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], viaTypes: [String]): ContainerConnection
Expand Down Expand Up @@ -2929,6 +2930,7 @@ type Note implements BasicObject & StixObject & StixCoreObject & StixDomainObjec
objectParticipant: [Participant!]
avatar: OpenCtiFile
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(first: Int, after: ID, orderBy: StixObjectOrStixRelationshipsOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], all: Boolean): StixObjectOrStixRelationshipRefConnection
relatedContainers(first: Int, after: ID, orderBy: ContainersOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], viaTypes: [String]): ContainerConnection
Expand Down Expand Up @@ -3063,6 +3065,7 @@ type ObservedData implements BasicObject & StixObject & StixCoreObject & StixDom
objectParticipant: [Participant!]
avatar: OpenCtiFile
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(first: Int, after: ID, orderBy: StixObjectOrStixRelationshipsOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], all: Boolean): StixObjectOrStixRelationshipRefConnection
relatedContainers(first: Int, after: ID, orderBy: ContainersOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], viaTypes: [String]): ContainerConnection
Expand Down Expand Up @@ -3172,6 +3175,7 @@ type Opinion implements BasicObject & StixObject & StixCoreObject & StixDomainOb
objectParticipant: [Participant!]
avatar: OpenCtiFile
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(first: Int, after: ID, orderBy: StixObjectOrStixRelationshipsOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], all: Boolean): StixObjectOrStixRelationshipRefConnection
relatedContainers(first: Int, after: ID, orderBy: ContainersOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], viaTypes: [String]): ContainerConnection
Expand Down Expand Up @@ -3300,6 +3304,7 @@ type Report implements BasicObject & StixObject & StixCoreObject & StixDomainObj
objectAssignee: [Assignee!]
avatar: OpenCtiFile
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(first: Int, after: ID, orderBy: StixObjectOrStixRelationshipsOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], all: Boolean): StixObjectOrStixRelationshipRefConnection
relatedContainers(first: Int, after: ID, orderBy: ContainersOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], viaTypes: [String]): ContainerConnection
Expand Down Expand Up @@ -9316,6 +9321,7 @@ type Grouping implements BasicObject & StixObject & StixCoreObject & StixDomainO
objectParticipant: [Participant!]
avatar: OpenCtiFile
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(first: Int, after: ID, orderBy: StixObjectOrStixRelationshipsOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], all: Boolean): StixObjectOrStixRelationshipRefConnection
relatedContainers(first: Int, after: ID, orderBy: ContainersOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], viaTypes: [String]): ContainerConnection
Expand Down Expand Up @@ -10123,6 +10129,7 @@ type Task implements Container & StixDomainObject & StixCoreObject & StixObject
objectParticipant: [Participant!]
avatar: OpenCtiFile
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(first: Int, after: ID, orderBy: StixObjectOrStixRelationshipsOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], all: Boolean): StixObjectOrStixRelationshipRefConnection
relatedContainers(first: Int, after: ID, orderBy: ContainersOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], viaTypes: [String]): ContainerConnection
Expand Down Expand Up @@ -10264,6 +10271,7 @@ interface Case implements BasicObject & StixObject & StixCoreObject & StixDomain
objectParticipant: [Participant!]
avatar: OpenCtiFile
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(first: Int, after: ID, orderBy: StixObjectOrStixRelationshipsOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], all: Boolean): StixObjectOrStixRelationshipRefConnection
relatedContainers(first: Int, after: ID, orderBy: ContainersOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], viaTypes: [String]): ContainerConnection
Expand Down Expand Up @@ -10388,6 +10396,7 @@ type CaseIncident implements BasicObject & StixObject & StixCoreObject & StixDom
objectParticipant: [Participant!]
avatar: OpenCtiFile
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(first: Int, after: ID, orderBy: StixObjectOrStixRelationshipsOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], all: Boolean): StixObjectOrStixRelationshipRefConnection
relatedContainers(first: Int, after: ID, orderBy: ContainersOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], viaTypes: [String]): ContainerConnection
Expand Down Expand Up @@ -10513,6 +10522,7 @@ type CaseRfi implements BasicObject & StixObject & StixCoreObject & StixDomainOb
objectParticipant: [Participant!]
avatar: OpenCtiFile
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(first: Int, after: ID, orderBy: StixObjectOrStixRelationshipsOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], all: Boolean): StixObjectOrStixRelationshipRefConnection
relatedContainers(first: Int, after: ID, orderBy: ContainersOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], viaTypes: [String]): ContainerConnection
Expand Down Expand Up @@ -10636,6 +10646,7 @@ type CaseRft implements BasicObject & StixObject & StixCoreObject & StixDomainOb
objectParticipant: [Participant!]
avatar: OpenCtiFile
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(first: Int, after: ID, orderBy: StixObjectOrStixRelationshipsOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], all: Boolean): StixObjectOrStixRelationshipRefConnection
relatedContainers(first: Int, after: ID, orderBy: ContainersOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], viaTypes: [String]): ContainerConnection
Expand Down Expand Up @@ -10760,6 +10771,7 @@ type Feedback implements BasicObject & StixObject & StixCoreObject & StixDomainO
objectParticipant: [Participant!]
avatar: OpenCtiFile
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(first: Int, after: ID, orderBy: StixObjectOrStixRelationshipsOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], all: Boolean): StixObjectOrStixRelationshipRefConnection
relatedContainers(first: Int, after: ID, orderBy: ContainersOrdering, orderMode: OrderingMode, filters: FilterGroup, search: String, types: [String], viaTypes: [String]): ContainerConnection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3160,6 +3160,7 @@ interface Container {
avatar: OpenCtiFile
# Container
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(
first: Int
Expand Down Expand Up @@ -3319,6 +3320,7 @@ type Note implements BasicObject & StixObject & StixCoreObject & StixDomainObjec
avatar: OpenCtiFile
# Container
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(
first: Int
Expand Down Expand Up @@ -3551,6 +3553,7 @@ type ObservedData implements BasicObject & StixObject & StixCoreObject & StixDom
avatar: OpenCtiFile
# Container
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(
first: Int
Expand Down Expand Up @@ -3759,6 +3762,7 @@ type Opinion implements BasicObject & StixObject & StixCoreObject & StixDomainOb
avatar: OpenCtiFile
# Container
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(
first: Int
Expand Down Expand Up @@ -3985,6 +3989,7 @@ type Report implements BasicObject & StixObject & StixCoreObject & StixDomainObj
avatar: OpenCtiFile
# Container
authorized_members: [MemberAccess!]
authorized_members_activation_date: DateTime
currentUserAccessRight: String
objects(
first: Int
Expand Down
10 changes: 9 additions & 1 deletion opencti-platform/opencti-graphql/src/database/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ import { validateInputCreation, validateInputUpdate } from '../schema/schema-val
import { telemetry } from '../config/tracing';
import { cleanMarkings, handleMarkingOperations } from '../utils/markingDefinition-utils';
import { generateCreateMessage, generateRestoreMessage, generateUpdateMessage } from './generate-message';
import { confidence, creators, iAliasedIds, iAttributes, modified, updatedAt, xOpenctiStixIds } from '../schema/attribute-definition';
import { authorizedMembersActivationDate, confidence, creators, iAliasedIds, iAttributes, modified, updatedAt, xOpenctiStixIds } from '../schema/attribute-definition';
import { ENTITY_TYPE_INDICATOR } from '../modules/indicator/indicator-types';
import { ENTITY_TYPE_CONTAINER_FEEDBACK } from '../modules/case/feedback/feedback-types';
import { FilterMode, FilterOperator } from '../generated/graphql';
Expand Down Expand Up @@ -1904,6 +1904,14 @@ export const updateAttributeMetaResolved = async (context, user, initial, inputs
throw UnsupportedError('This feature is disabled');
}
accessOperation = 'manage-access';
if (schemaAttributesDefinition.getAttribute(initial.entity_type, authorizedMembersActivationDate.name)
&& (!initial.authorized_members || initial.authorized_members.length === 0)
&& updates.some((e) => e.key === 'authorized_members' && e.value?.length > 0)) {
updates.push({
key: authorizedMembersActivationDate.name,
value: [now()]
});
}
}
if (updates.some((e) => e.key === 'authorized_authorities')) {
accessOperation = 'manage-authorities-access';
Expand Down
Loading

0 comments on commit 5585997

Please sign in to comment.