Skip to content

Commit

Permalink
fix(fileinfos) : #MAG-291 fix download and lool edit rights with lock…
Browse files Browse the repository at this point in the history
…ed cards
  • Loading branch information
Florent Mariotti committed Dec 20, 2024
1 parent cb65a4f commit 1a7ac09
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions frontend/src/components/card-content-file/CardContentFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const CardContentFile: FC<CardContentFileProps> = ({ card }) => {
displayModals,
hasEditRights,
hasContribRights,
hasManageRights,
behaviours,
} = useBoard();

Expand Down Expand Up @@ -70,14 +71,17 @@ export const CardContentFile: FC<CardContentFileProps> = ({ card }) => {
window.open(`/workspace/document/${card.resourceId}`);
};

const canDownload = card.locked ? hasManageRights() : hasContribRights();

const edit = (): void => {
behaviours?.applicationsBehaviours["lool"]?.openOnLool(cardDocument);
};

const canEdit = (): boolean => {
if (
behaviours?.applicationsBehaviours["lool"]?.provider === null ||
cardDocument === undefined
cardDocument === undefined ||
(card.locked ? !hasManageRights() : !hasEditRights())
)
return false;
const ext: string[] = [
Expand All @@ -96,7 +100,7 @@ export const CardContentFile: FC<CardContentFileProps> = ({ card }) => {
!behaviours?.applicationsBehaviours["lool"]?.failed &&
behaviours?.applicationsBehaviours["lool"]?.canBeOpenOnLool(cardDocument);

return !!canEditDocument && hasEditRights() && isoffice && canBeOpenOnLool;
return !!canEditDocument && isoffice && canBeOpenOnLool;
};

return (
Expand All @@ -106,7 +110,7 @@ export const CardContentFile: FC<CardContentFileProps> = ({ card }) => {
owner={cardDocument?.ownerName ?? ""}
size={size}
fileType={extensionText}
canDownload={hasContribRights()}
canDownload={canDownload}
onDownload={download}
canEdit={canEdit()}
onEdit={edit}
Expand Down

0 comments on commit 1a7ac09

Please sign in to comment.