Skip to content

Commit

Permalink
[backend/frontend] fix max shareable markings in public dashboard fro…
Browse files Browse the repository at this point in the history
…m user (#7006)
  • Loading branch information
Archidoit committed May 24, 2024
1 parent 7ff4555 commit eddfa7a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions opencti-platform/opencti-graphql/src/domain/group.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as R from 'ramda';
import { uniq } from 'ramda';
import { createRelation, deleteElementById, deleteRelationsByFromAndTo, patchAttribute, updateAttribute } from '../database/middleware';
import {
internalFindByIds,
Expand Down Expand Up @@ -118,13 +117,13 @@ export const defaultMarkingDefinitionsFromGroups = async (context, groupIds) =>
});
};

// return an array of promises composed of the max shareable markings of the groups
// return: array of the max shareable markings arrays of the different groups
export const maxShareableMarkingDefinitionsFromGroups = async (context, groupIds) => {
// Retrieve max shareable markings by groups
return internalFindByIds(context, SYSTEM_USER, groupIds, { type: ENTITY_TYPE_GROUP })
.then((groups) => groups.map((group) => {
return groupMaxShareableMarkings(context, SYSTEM_USER, group);
}).flat());
}));
};

export const rolesPaginated = async (context, user, groupId, args) => {
Expand Down
2 changes: 1 addition & 1 deletion opencti-platform/opencti-graphql/src/domain/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ const getUserAndGlobalMarkings = async (context, userId, userGroups, capabilitie
);
const maxShareableMarkings = await Promise.all(maxShareableMarkingsPromiseArray);
const computedMarkings = computeAvailableMarkings(userMarkings, markings);
return { user: computedMarkings, all: markings, default: defaultMarkings, max_shareable: uniq(maxShareableMarkings) };
return { user: computedMarkings, all: markings, default: defaultMarkings, max_shareable: uniq(maxShareableMarkings.flat()) };
};

export const getRoles = async (context, userGroups) => {
Expand Down

0 comments on commit eddfa7a

Please sign in to comment.