Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoints for copying Mauro models and items #457

Open
pjmonks opened this issue May 7, 2024 · 0 comments · May be fixed by #465
Open

Add endpoints for copying Mauro models and items #457

pjmonks opened this issue May 7, 2024 · 0 comments · May be fixed by #465
Assignees
Labels
enhancement New feature or request

Comments

@pjmonks
Copy link
Contributor

pjmonks commented May 7, 2024

Description

Mauro has some abilities to copy catalogue items, yet it does not provide enough public HTTP endpoints to carry these operations out. These need to be included to support the copying of items - this will make it easier to create new items based on more complex items which already contain a lot of information.

The following domain types must be supported:

  • Data Models
  • Terminology
  • Term
  • Code Set

Note: Data Classes and Data Elements are also required to fulfil a use case, but endpoints already exist for these types.

Scope

The copy actions should only be allowed for models or sub-items which are within a draft versioned folder. It would not make sense for a model to be allowed to be copied in a finalised versioned folder - this can just be forked. This copy action represents a user wanting to copy an existing catalogue item to base on and then modify.

URL Mappings and Services

Each item service e.g. DataModelService already has a copyModel() method (or similar), they just need to be mapped to controllers and endpoints.

The interceptors of each controller should be modified so that if a copy operation is requested, check that the current user is allowed to edit the target model/item and read the source model/item.

Available Actions

The UserSecurityPolicyManager contains methods to fetch the available actions allowed for an item. The copy action should be included in this list as appropriate. This will assist the frontend for deciding which options are shown to the user.

copy should only be allowed when a model (or sub-item) is within a draft versioned folder.

Asynchronous action

Compared to a new fork, Mauro should allow a copy to be asynchronous if requested as a parameter.

@pjmonks pjmonks added the enhancement New feature or request label May 7, 2024
mhocc added a commit that referenced this issue May 23, 2024
-   The test is not currently passing and this may be because the test
    model is not valid.
-   Worked around the security restriction in `DataModelInterceptor`—needs reviewing
-   Noticed that copy permisssions is not implemented and will throw is
    requested.
@pjmonks pjmonks linked a pull request May 23, 2024 that will close this issue
@pjmonks pjmonks self-assigned this May 23, 2024
pjmonks added a commit that referenced this issue May 24, 2024
- Found issues with initial controller action, was not committing the copy to Mauro or setting model security correctly
- Moved controller action into ModelController for other model domains to use
- Changed URL to `PUT /dataModels/{id}/copy` to look consistent with fork endpoint
- Altered the PUT request body to not need branch name or version number. This will only work within a draft versioned folder, these will be inherited
- Updated test
pjmonks added a commit that referenced this issue May 24, 2024
- Ensure that new label selected is unique
- Reorganise tests
- Add additional tests to guarantee some of the edge cases - label uniqueness, source model exists, source model is not finalised
pjmonks added a commit that referenced this issue May 24, 2024
- Must be within a draft versioned folder
- Must be copied to the same versioned folder (but can be in a different sub-folder)
- Update tests to check all conditions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants