Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/backend/src/auth/SampleAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export class SampleAuthorization {
agent: UserWithRole | null,
sampleOrSampleId: Sample | number
): Promise<boolean> {
const isUserOfficer = this.userAuth.isUserOfficer(agent);
if (isUserOfficer) {
return true;
}
const sample = await this.resolveSample(sampleOrSampleId);

if (!sample) {
Expand Down
24 changes: 24 additions & 0 deletions apps/e2e/cypress/e2e/genericTemplates.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,10 @@ context('GenericTemplates tests', () => {

cy.contains('button', 'Clone').click();

cy.get('#customized-dialog-title').contains('Copy of');

cy.get('[data-cy="close-modal-btn"]').click();

cy.get('[data-cy="questionnaires-list-item"]').should('have.length', 2);

cy.get('[data-cy="questionnaires-list-item-completed:true"]').should(
Expand Down Expand Up @@ -1485,6 +1489,10 @@ context('GenericTemplates tests', () => {

cy.contains('button', 'Clone').click();

cy.get('#customized-dialog-title').contains('Copy of');

cy.get('[data-cy="close-modal-btn"]').click();

cy.get('[data-cy="questionnaires-list-item"]').should('have.length', 2);

cy.contains('Reset').click();
Expand Down Expand Up @@ -1559,12 +1567,20 @@ context('GenericTemplates tests', () => {

cy.contains('button', 'Clone').click();

cy.get('#customized-dialog-title').contains('Copy of');

cy.get('[data-cy="close-modal-btn"]').click();

cy.get('[data-cy="questionnaires-list-item"]').should('have.length', 2);

cy.get('[data-cy="clone"]').eq(0).click();

cy.contains('button', 'Clone').click();

cy.get('#customized-dialog-title').contains('Copy of');

cy.get('[data-cy="close-modal-btn"]').click();

cy.get('[data-cy="questionnaires-list-item"]').should('have.length', 3);

cy.contains('Reset').click();
Expand Down Expand Up @@ -1742,6 +1758,10 @@ context('GenericTemplates tests', () => {

cy.contains('button', 'Clone').click();

cy.get('#customized-dialog-title').contains('Copy of');

cy.get('[data-cy="close-modal-btn"]').click();

cy.get('[data-cy="delete"]').eq(0).click();

cy.contains('OK').click();
Expand Down Expand Up @@ -1797,6 +1817,10 @@ context('GenericTemplates tests', () => {

cy.contains('button', 'Clone').click();

cy.get('#customized-dialog-title').contains('Copy of');

cy.get('[data-cy="close-modal-btn"]').click();

cy.get('[data-cy="questionnaires-list-item"]').should('have.length', 2);

cy.contains('Save').click();
Expand Down
8 changes: 8 additions & 0 deletions apps/e2e/cypress/e2e/samples.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ context('Samples tests', () => {

cy.contains('OK').click();

cy.get('#customized-dialog-title').contains('Sample Declaration');

cy.get('[data-cy="close-modal-btn"]').click();

cy.get('[data-cy="questionnaires-list-item"]').should('have.length', 2);

cy.get('[data-cy="questionnaires-list-item-completed:true"]').should(
Expand Down Expand Up @@ -370,6 +374,10 @@ context('Samples tests', () => {

cy.contains('OK').click();

cy.get('#customized-dialog-title').contains('Sample Declaration');

cy.get('[data-cy="close-modal-btn"]').click();

cy.get('[data-cy="questionnaires-list-item"]').should('have.length', 2);

cy.get('[data-cy="questionnaires-list-item-completed:true"]').should(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ function QuestionaryComponentGenericTemplate(
newStateItems,
GENERIC_TEMPLATE_EVENT.ITEMS_MODIFIED
);
setSelectedGenericTemplate(clonedGenericTemplate);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function QuestionaryComponentSampleDeclaration(
const newStateItems = [...field.value, clonedSample];

updateFieldValueAndState(newStateItems);
setSelectedSample(clonedSample);
}
});

Expand Down
Loading