Skip to content

Commit

Permalink
fixed: records in analysis step cannot be deleted (#3470)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefano Ricci <SteRiccio@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 4, 2024
1 parent 8a452ed commit a5c57bb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/auth/authorizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const canEditRecord = (user, record) => {
return level === keys.all || (level === keys.own && Record.getOwnerUuid(record) === User.getUuid(user))
}

export const canDeleteRecord = canEditRecord
export const canDeleteRecord = (user, record) => canEditRecord(user, record) && !Record.isInAnalysisStep(record)

export const canCleanseRecords = _hasSurveyPermission(permissions.recordCleanse)

Expand Down
4 changes: 4 additions & 0 deletions webapp/views/App/views/Data/Records/Records.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
width: 100%;
}
}
.action-buttons-col {
display: flex;
width: 100%;
}
}
}
1 change: 1 addition & 0 deletions webapp/views/App/views/Data/Records/useColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export const useColumns = ({ categoryItemsByCodeDefUuid, navigateToRecord, onRec
},
{
key: 'action-buttons',
className: 'action-buttons-col',
renderItem: ({ item: record, itemPosition }) => {
const canEdit = Authorizer.canEditRecord(user, record)
const canDelete = Authorizer.canDeleteRecord(user, record)
Expand Down

0 comments on commit a5c57bb

Please sign in to comment.