Home Cards
The Home page of the React CMS shows a card for each side-menu item that has a Home card, as long as the user can open that item from the side menu and belongs to at least one group the card is enabled for. Each card has a title, a short description and an image, and opens the same page as its menu item. When no menu item carries a card for the user, the Home page stays as it was before this feature, which keeps installations without cards (Ex: Enricher) unchanged.
Home cards are global, like the menu: MIB is not multi-tenant and a card has no instance.
Administration
The cards are maintained on the pages adm_home_cards_list and adm_home_cards_form, reached through the menu item administration_home_cards (under menu_root_administration when the installation has that folder, otherwise at the root). Access to the pages is granted per group like any other menu item.
| Field | Required | Behaviour |
|---|---|---|
| Menu item | Yes | Lists the React menu items of this BFF that have a URL, shown as their menu path (Ex: Content › Movies). Folders are not offered. A menu item has at most one card, and a second card for the same item is refused with a validation message. |
| Title | No | Free text or a dictionary token (Ex: {DICT:HOME/MOVIES}). When empty, the card uses the label of the menu item. |
| Description | No | Free text or a dictionary token. |
| Image | No | png, jpg/jpeg, svg or webp. When empty, the card shows the icon of the menu item. |
Where a card points to a menu item that is no longer in the menu of the BFF, the card stays in the list and can still be edited or deleted, but no user gets it.
Groups block
Below the form, the Groups block lists every group the administrator can see, each with an Enabled switch. All switches are on by default, groups created after the card included. Turning a switch off hides the card for that group, and turning it back on shows it again. The block has no add or remove, and it is not shown in a bulk edit of several cards, since its switches are those of one card.
The groups are listed by the authorization service, which applies the instance filter and hides group 1 (Administrators) from administrators who are not full administrators; the switches of the groups not shown stay as they are. Listing the groups requires the admin or authadmin role, so for a card administrator without one of them the block is shown empty and read-only, while the rest of the form keeps working.
Only the switched-off groups are stored, as rows of ADM_HOME_CARD_GROUPS (CARD_ID, GROUP_ID). GROUP_ID has no foreign key, in order that deleting a group is never blocked (a row left for a deleted group is inert), and deleting a card removes its rows by a cascade on CARD_ID.
Grants
| Who | Grants |
|---|---|
| Card administrators | Create, edit and delete on ADM_HOME_CARDS, ADM_HOME_CARD_IMAGES and ADM_HOME_CARD_GROUPS, read on the metadata media types the generic pages load (MEDIA_TYPES, ADM_FIELDS, ADM_ENUMTYPES, ADM_ENUMVALUES, ADM_RELATEDS and ADM_FILEEXTENSIONS), plus the admin or authadmin role to manage the Groups block. |
| End users | Nothing new: a user gets a card through the menu permission of its menu item and the groups the user belongs to. |
Who gets a card
A user gets a card only when both conditions hold:
- The menu item of the card is in the side menu of the user with its URL, that is, the user has the menu permission on the item itself. An item kept in the menu only as a folder (no permission on it, but on one of its children) has an empty URL and carries no card. An item with a URL and children can have a card.
- The user belongs to at least one group whose switch is on for the card. A user without groups gets no card, user 1 (Administrator) included, since administrators follow the same rule.
The second condition is resolved by the Permission microservice, which keeps a snapshot of the cards refreshed at least every 60 seconds and reads the groups of the user on every request. Card changes therefore reach users within one minute, and changes to the groups of a user on the next menu load, without a deploy or restart.
API contract
GET /api/v2/menu
Any menu item, at any depth of the tree, may carry an optional card object. When it is absent there is no card for this user on that item. Only this endpoint carries card: GET /api/v2/menu/favorites, GET /api/v2/menu/history and the legacy menu stay as they are, and opening a page does not load the cards.
{
"menuItemKey": "movies_list",
"label": "Movies",
"icon": "PlaySquareOutlined",
"path": "/app/movies_list",
"card": {
"title": "Movies",
"description": "Browse and edit the movie catalog",
"image": "/api/v2/menu/cards/movies_list/image?v=3f9c2a71b04e5d16"
}
}
Where title is never empty (it falls back to the label of the menu item), description may be null, and image is null when the card has no image, its upload did not complete or it has no storage area. Dictionary tokens in label, title and description are translated in the response like any other {DICT:...} marker, so the client receives and sorts translated text.
When the cards cannot be loaded (the Permission microservice fails or does not offer cards yet), the menu is returned without card. A failure is logged as an error, except the 404 of a Permission microservice that does not offer cards yet, which is logged in Verbose. While the cards, images, groups and menu permissions do not change, the payload is identical and the menu keeps answering 304 to the same ETag.
GET /api/v2/menu/cards/{menuItemKey}/image
Returns the image of the card of menuItemKey, with the same authentication as /api/v2/menu (session cookie or bearer), only when the user gets that card under the rule above, and 404 otherwise, whatever the reason. v is a version of the image file and changes only when the file changes, so the response is cached as private, max-age=31536000, immutable when v is the current version, and as private, no-cache otherwise (Ex: a menu payload loaded before the image was replaced). SVG images are served with Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline' and X-Content-Type-Options: nosniff, in order that opening the URL directly cannot run script.
The file is downloaded through the FileManagement microservice with the token of the user, so users need no read permission on ADM_HOME_CARD_IMAGES.
Dictionary keys
The Home page reads the dictionary keys cms/home_cards_title and cms/home_cards_subtitle for the heading of the cards, and falls back to "Quick Access" and "Jump straight to the section you use most" when they are missing. The titles and descriptions of the cards may use any dictionary key of the installation.
The Groups block of the form reads the server dictionary keys ACCOUNT/FORMGROUPNAMELABEL and HOMECARDS/ENABLED for its column titles.
Configurations
The card tables live in the api database. Installations whose authorization database is separate from the api database must give the Permission microservice the api database alias; see Permission microservice - Home cards. The image upload requires storageArea configured in the environment, as any other upload.