Menus
What are they?
Section titled “What are they?”A menu is a section within a category menu that contains one entity, allowing to display it only for the roles that have access to it or disable its visibility within the app.
Definition and purpose of Menus within the system.
Section titled “Definition and purpose of Menus within the system.”Menus are a system entity. Their purpose is to display a logical entity within a category menu. Allows a system entity to be shown only for the roles that have access to it and turn its visibility on or off.
How are they used?
Section titled “How are they used?”When creating a category menu, you can create or add existing menus to it. Each menu must have a name, an entity linked to it, and a visibility status. When the menu visibility is set to false, it will be hidden for all roles on the system. When the menu visibility is set to true, it will be shown for the roles that have access to it.
Use case example
Section titled “Use case example”Suppose you have a category menu called “Research Management”. You want to add two menus for the entities “Experiment Protocols” and “Data Pipelines”, each with different access requirements and visibility settings.
-
Create the structure:
-
Assign roles:
- Grant access to the
Research Managementcategory menu to the rolesLead ScientistandLab Manager.
- Grant access to the
-
Result:
- Users with the
Lead ScientistorLab Managerroles will see theResearch Managementcategory menu. - Within this category, they will see the
Experiment Protocolsmenu because its visibility is set totrue. - The
Data Pipelinesmenu will not be visible to any users, regardless of their roles, because its visibility is set tofalse. - When the
Data Pipelinesare completed and ready to be accessed, you can change its visibility totrue, making it available to the same roles.
- Users with the
Structure of a Menu
Section titled “Structure of a Menu”A menu has the following structure:
{ "id": 1, "visible": true, "entity": "ExperimentProtocol", "menuName": "Experiment Protocols (example)",
// Categories in which the menu is included. "categoryMenus": [ { "id": 1, "name": "Research Management" } ]}Endpoints for menu management
Section titled “Endpoints for menu management”Below are the available endpoints for managing menus:
Get all menus
Section titled “Get all menus”Retrieve all menus stored.
Endpoint:
GET /api/v1/menus/Response example:
{"status": 200,"error": false,"errors": [ {} ],"message": "string","data": [ { <Menu> } ],"pagination": { <Pagination> }}
Get a menu
Section titled “Get a menu”Retrieve a specific menu by its ID.
Endpoint:
GET /api/v1/menus/:idResponse example:
{"status": 200,"error": false,"errors": [ {} ],"message": "string","data": [ { <Menu> } ],"pagination": { <Pagination> }}
Create a menu
Section titled “Create a menu”Create a new menu.
Endpoint:
POST /api/v1/menus/<Menu>Request example:
{"visibility": true,"entity": "ExperimentProtocol","menuName": "Experiment Protocols"}Response example:
{"status": 201,"error": false,"errors": [ {} ],"message": "string","data": [ { <Menu> } ],"pagination": { <Pagination> }}
Update a menu
Section titled “Update a menu”Update an existing menu.
Endpoint:
PUT /api/v1/menus/:id<Menu>Request example:
{"visibility": false,"entity": "ExperimentProtocol","menuName": "Experiment Protocols"}Response example:
{"status": 200,"error": false,"errors": [ {} ],"message": "string","data": [ { <Menu> } ],"pagination": { <Pagination> }}
Delete a menu
Section titled “Delete a menu”Delete a specific menu by its ID.
Endpoint:
DELETE /api/v1/menus/:idResponse example:
{"status": 200,"error": false,"errors": [ {} ],"message": "string","data": [ { <Menu> } ],"pagination": { <Pagination> }}
Endpoints for assigning categories to a menu
Section titled “Endpoints for assigning categories to a menu”Below are the available endpoints for assigning categories to menus:
Get all categories assigned to a menu
Section titled “Get all categories assigned to a menu”Retrieve all categories assigned to a specific menu.
Endpoint:
GET /api/v1/menus/:id/category-menusResponse example:
{"status": 200,"error": false,"errors": [ {} ],"message": "string","data": [ { <CategoryMenu> } ],"pagination": { <Pagination> }}
Assign multiple categories to a menu
Section titled “Assign multiple categories to a menu”Assign multiple categories to a specific menu.
Endpoint:
POST /api/v1/menus/:id/category-menusRequest example:
{"categoryMenuIds": [1, 2]}Response example:
{"status": 200,"error": false,"errors": [ {} ],"message": "string","data": [ { <CategoryMenu> } ],"pagination": { <Pagination> }}
Remove one or more categories from a menu
Section titled “Remove one or more categories from a menu”Remove one or more categories from a specific menu.
Endpoint:
DELETE /api/v1/menus/:id/category-menusRequest example:
{"categoryMenuIds": [2]}Response example:
{"status": 200,"error": false,"errors": [ {} ],"message": "string","data": [ { <CategoryMenu> } ],"pagination": { <Pagination> }}