Skip to content

Commit

Permalink
rename utils function
Browse files Browse the repository at this point in the history
  • Loading branch information
lndrtrbn committed Aug 19, 2024
1 parent e50dede commit a5c8c7a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { findAll as findAllWorkspaces } from '../workspace/workspace-domain';
import { ENTITY_TYPE_MARKING_DEFINITION } from '../../schema/stixMetaObject';
import { getEntitiesMapFromCache } from '../../database/cache';
import type { BasicStoreRelation, NumberResult, StoreMarkingDefinition, StoreRelationConnection } from '../../types/store';
import { checkUserAccessRights, getWidgetArguments } from './publicDashboard-utils';
import { checkUserIsAdminOnDashboard, getWidgetArguments } from './publicDashboard-utils';
import {
findAll as stixCoreObjects,
stixCoreObjectsDistribution,
Expand Down Expand Up @@ -232,7 +232,7 @@ export const publicDashboardEditField = async (
id: string,
input: EditInput[],
) => {
await checkUserAccessRights(context, user, id);
await checkUserIsAdminOnDashboard(context, user, id);
const { element } = await updateAttribute(
context,
user,
Expand All @@ -254,7 +254,7 @@ export const publicDashboardEditField = async (
};

export const publicDashboardDelete = async (context: AuthContext, user: AuthUser, id: string) => {
await checkUserAccessRights(context, user, id);
await checkUserIsAdminOnDashboard(context, user, id);
const deleted = await deleteElementById(
context,
user,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const getWidgetArguments = async (
};
};

export const checkUserAccessRights = async (context: AuthContext, user: AuthUser, id: string) => {
export const checkUserIsAdminOnDashboard = async (context: AuthContext, user: AuthUser, id: string) => {
const publicDashboards = await getEntitiesListFromCache<PublicDashboardCached>(context, SYSTEM_USER, ENTITY_TYPE_PUBLIC_DASHBOARD);
const publicDashboard = publicDashboards.find((p) => (p.id === id));
if (publicDashboard === undefined) {
Expand Down

0 comments on commit a5c8c7a

Please sign in to comment.