Skip to content

Media Library Applet

The file store behind the Customer Portal: drives, directories and files, with a share policy per file that decides whether the storefront can show it, and a small list of categories. Master data only — nothing posts, nothing creates a document. The storefront always uses the public link, which serves a file only when its policy is anyone with the link; a new file defaults to restricted, and a restricted link works for the uploader alone, because nobody else can be added to a file’s access list from this applet. Adding a user under Manage Users grants no access.

Overview

The Media Library applet is the file store behind the Customer Portal. You create drives (named containers), put directories and files — images, video, audio, PDF — inside them, and set a share policy per file that decides whether the storefront can show it. It also keeps a small list of categories (labels) for the file store. The CP Commerce Admin applet then points its gallery and slideshow widgets at a drive, offers PDF files as menu-item targets, and can copy post images to and from the library.

It is a master-data applet. Nothing in it posts to stock or the General Ledger, and nothing in it creates a document. Its drives, files and categories are tenant-wide records in the platform’s file store.

Where it fits

DirectionApplet / systemHow it connects
DownstreamCP Commerce Admin — Website › Layout Instance › node configurationThe Image Gallery, Video Gallery and Audio Gallery widgets and the slideshow Play List are configured with a drive chosen from this applet’s drives.
DownstreamCP Commerce Admin — Website › Menu ItemsA menu item of the PDF type lists only files whose mime type contains pdf and whose share policy is ANYONE_WITH_LINK.
DownstreamCP Commerce Admin — Website › Post › Manage Image, Notification › Manage ImagePost images can be created from the library and copied to it.
DownstreamCP Commerce Admin — Facilities / ActivitiesEach facility and activity keeps its own links to library files.
DownstreamThe Customer Portal storefrontShows every image through the file’s public link, which serves a file only if its share policy is ANYONE_WITH_LINK.
UpstreamTenant AdminThe Manage Users tab lists the tenant’s confirmed logins as candidates for a drive.
UpstreamTenant permissionsEvery drive, file, drive-user and category action checks an API_TNT_DM_FM_* permission unless the login is a tenant owner or admin.
    flowchart LR
  D[Drive] --> F[Directory / File]
  F --> P{Share policy}
  P -- RESTRICTED --> L[login-ep link: only guests in acl_config]
  P -- ANYONE_WITH_LINK --> R[raw link: anonymous]
  R --> W[Storefront widgets, PDF menu items]
  D --> G[CP Commerce Admin gallery and play-list widgets]
  

Screens and menus

The sidebar has two entries, Drive and Categories; the applet opens on Drive. Both work in the usual two-column stack.

Drive

  • Drives Listing — server-side ag-grid: Name, Code, Status, Date Created (sorted newest first). A keyword search (drive name) and an advanced search on Status, Creation Date and Modified Date. The + button opens Create Drive. Each row also triggers a lookup of the creator’s e-mail that is fetched and then discarded (getRowsFactory), so the listing makes one extra call per row for nothing.
  • Create Drive — Drive Code, Drive Name, Status, Description; CREATE.
  • Drive Edit — three tabs. Details (code read-only, name, description, status, created/modified by and date, Delete Drive); Manage Files; Manage Users. SAVE at the top.
  • Manage Files (inside Drive Edit) — a tree grid of the drive’s directories and files (up to 10,000 rows loaded in one call, ordered by sort order), with a quick filter. The + button opens Create File; clicking a row opens Edit File.
  • Create File — File Name, Status, Description, Parent Directory, File Type (DIRECTORY or FILE); for a file, Sort Order and a drop-zone that previews an image, plays a video or renders a PDF before upload. CREATE.
  • Edit File — the same fields (type read-only) with the stored media shown, a replacement drop-zone, Save, Share File and DELETE.
  • Share File — Access Policy (RESTRICTED / ANYONE_WITH_LINK) and the matching File Link with a Copy Link button. Changing the policy saves immediately; Done only goes back. The “Add people” e-mail and role controls are commented out of the template, so guests cannot be granted from the UI (see Lifecycle).
  • Manage Users (inside Drive Edit) — the drive’s login-subject links; + opens Select Users to add to the drive (a checkbox grid of the tenant’s logins, Add); clicking a row opens Removing user from the drive (Delete).

Categories

  • Categories Listing — Categories Name, Categories Code, Status, Creation Date; keyword search and advanced search (Category Name, Created / Modified Date).
  • Create Category / Category Edit — Category Name, Category Code, Status, Description (edit adds the read-only audit fields and a Delete button).

Settings (gear): System Configuration › Field Settings, Default Selection; Client Side Permissions › Applet Access; Server Side Permissions › Permission Set, User Permission, Team Permission, Role Permission; Integration › Triggers (the shared webhook stub); Developer Tools › Applet Log, Reset Applet State (both route to the 404 page). Personalization: Default Selection and the shared Sidebar screen.

This page is published without screenshots; none has been captured on a tenant free of customer data.

Configuration

Before you can use it

  • A confirmed tenant login for anyone who will manage drives, and — unless the login is a tenant owner or admin — the file-management permissions, assigned through Settings › Permission Set / User / Team / Role Permission: API_TNT_DM_FM_DRIVE_CREATE / UPDATE / DELETE / READ (or OWNER / ADMIN) for drives; the same set with FILE for directories and files, plus API_TNT_DM_FM_FILE_UPDATE_ACL_CONFIG_POLICY for the Share File screen; API_TNT_DM_FM_DRIVE_SUBJECT_* for Manage Users; API_TNT_DM_FM_LABEL_* and API_TNT_DM_FM_LABEL_LIST_READ for Categories. Uploading a file’s content needs FILE_UPDATE (or owner / admin), not FILE_CREATE.
  • For the Categories menu only: a label list with code Media_library and label type CP_COM must already exist. Create Category looks it up and attaches every new category to it; nothing in this applet creates that list. If it is missing, the create screen fails before anything is saved (see Troubleshooting).
  • For the storefront: a website configured in CP Commerce Admin whose widgets or menu items will reference a drive or a file, and files set to ANYONE_WITH_LINK.

Applet settings

Neither of this applet’s settings screens works, so there is nothing to configure here:

  • Field Settings shows eight slide toggles (Lines Settings: Unit Discount, SST/VAT/GST, WHT, Blanket Order; Department Settings: Segment, G/L Dimension, Profit Center, Project) and a SAVE button. None of them is saved and SAVE does nothing.
  • Default Selection shows Default Branch and Default Location. Changing a value raises an error and SAVE saves nothing — and nothing in the applet would use either value if it did.
  • Personalization › Default Selection has the same defect.

Settings in other applets that control this applet

SettingWhere it is setEffect here
A widget’s Select Drive / Select Drive For Play ListCP Commerce Admin › Website › Layout Instance › node configuration (Image / Video / Audio Gallery, slideshow)Decides which of this applet’s drives a storefront gallery reads. The widget lists drives by code.
A menu item’s PDF targetCP Commerce Admin › Website › Menu ItemsOnly files with mime type pdf and policy ANYONE_WITH_LINK are offered.

Feature visibility / permissions

The applet has no client-side permissions of its own. Access is decided by the server-side API_TNT_DM_FM_* permissions listed under Before you can use it; the applet answers not authorised when none applies. The Permission Set screen’s target picker knows the CP Commerce target views (Company, Branch, CMS Website, Label, Label List, and so on) but has no entry for drives or files, so a permission scoped to one drive cannot be assigned from this applet.

Fields

Required-ness below is the server’s unless marked client. The server checks that a record is valid and that what it links to exists; it does not check that a name or code is present, so those rules are enforced by the form alone.

Create Drive / Drive Edit › Details

FieldRequiredNotes / validation
Drive CodeYes (client)Max 255 characters; read-only after creation. Not checked for uniqueness — two drives can share a code, and a widget lists drives by code.

Created By / Date and Modified By / Date are shown read-only, as the login’s e-mail.

Create File / Edit File

FieldRequiredNotes / validation
File NameYes (client)Max 255. For an uploaded file the server overwrites it with the uploaded file’s own name, on upload and on replace, so the name typed here survives only for directories.
Parent DirectoryNoOffers NONE plus the drive’s directories. A file’s parent must be a directory: the save is refused when the parent is itself a file, or when it is gone.
File TypeYesDIRECTORY or FILE; read-only on edit. A directory with no parent must belong to a drive.
Sort OrderNoFiles only — the box is not offered for a directory. Manage Files loads the drive lowest number first; anything left blank, every directory included, comes after the numbered files, so number every file whose position matters.
File (drop-zone)Yes on create for type FILE (client: Please select a file)Accepts audio, video, image and PDF. On edit, dropping a new file replaces the stored one after the details are saved; the server records name, extension and file type from the upload.

Share File

FieldNotes
Access PolicyRESTRICTED (default on create) or ANYONE_WITH_LINK. Saved immediately on change; on a directory the change also applies to the directory’s direct children — one level only, not their children.
File LinkThe public link for ANYONE_WITH_LINK; a sign-in link for RESTRICTED. Copy Link copies it.

Manage Users

FieldNotes
Email / Phone (select grid)Checkbox grid of the tenant’s logins; Add links the login to the drive. A duplicate drive–login pair is refused (DRIVE_SUBJECT_OBJECT_COMPOUND_PK_ALREADY_EXISTS).
Email, Status (edit)Shown read-only. The e-mail is never looked up: the listing’s Email column shows an internal ID and the edit screen’s Email box is blank.

Create Category / Category Edit

FieldRequiredNotes
Category CodeYes (client)Not checked for uniqueness

Every category is attached, out of sight, to the Media_library / CP_COM label list found when the screen loads.

Lifecycle and effects

What it writes.

  • Create Drive creates the drive; SAVE writes back name, code, description and status; Delete Drive deletes the drive only. Files are not touched when their drive is deleted — they stay, pointing at a drive that no longer exists.
  • Create File for a DIRECTORY creates the directory only. For a FILE it uploads the content in the same step; the server stores it, gives it a random link key, and sets the default share policy: RESTRICTED, with the creator as the only person on the file’s access list.
  • Save on Edit File saves the editable fields, then — if a new file was dropped — replaces the content. An edit never changes a share link or policy, by accident or otherwise; only Share File can.
  • DELETE on Edit File deletes the file. For a directory the applet first checks for children and refuses (Cannot delete this Directory as it has child directories/files); the server has no such rule, so a directory deleted through the API leaves its children behind. Deleting a file does not remove its stored content.
  • Share File › Access Policy saves the policy (permission API_TNT_DM_FM_FILE_UPDATE_ACL_CONFIG_POLICY). The Add people controls are not shown and Done does nothing, so no one can be added to a file’s access list from this applet.
  • Manage Users › Add links a login to the drive; Delete removes the link. The links are only ever read back to list themselves. Adding a user to a drive grants no access; access is decided by the API_TNT_DM_FM_* permissions and, for reading a file’s content, by its share policy.
  • Categories are created, edited and deleted as standalone records. No screen attaches a category to a drive or a file, so a category does nothing until something else uses it.

How the share policy is enforced. The public link needs no sign-in and returns the file only when its policy is ANYONE_WITH_LINK; otherwise not authorised. The sign-in link needs a login and that login on the file’s access list as viewer, editor or commenter. Because the screen puts only the creator on that list and cannot add anyone else, a RESTRICTED link works for the uploader alone. The storefront always uses the public link, so every file the storefront must display has to be ANYONE_WITH_LINK.

Nothing posts. Not a document applet: no journal, no stock movement, no document number. It writes file-store records only.

Related applets

  • CP Commerce Admin — the consumer: gallery and play-list widgets read a drive, PDF menu items read ANYONE_WITH_LINK files, post images move to and from the library, facilities and activities link library files. Its own Manage Image screen is a separate image store for posts, not this applet.
  • Tenant Admin — the confirmed logins offered by Manage Users, and where the API_TNT_DM_FM_* permissions a media manager needs are ultimately granted.

Troubleshooting

SymptomCauseFix
An image or PDF referenced by a storefront widget or menu item does not loadThe file’s share policy is RESTRICTED (the default). The storefront uses the public link, which serves only ANYONE_WITH_LINK files; the PDF picker in CP Commerce Admin hides restricted files entirelyEdit File › Share File › set Access Policy to ANYONE_WITH_LINK
The RESTRICTED link works for the uploader and for nobody elseThe sign-in link admits only logins on the file’s access list, and the only one the screen ever puts there is the creatorUse ANYONE_WITH_LINK, or add people to the file’s access list through the API
A user added under Manage Users still cannot open the drive or its filesThe link is read back only to populate that same grid — nothing uses it to decide access; access comes from the API_TNT_DM_FM_* permissionsGrant the permissions under Settings › Permission Set / User Permission
Create on Create File does nothing, or the toast Please select a fileType FILE was chosen without dropping a fileDrop or browse a file, then Create
The saved file name is not the one typedThe server replaces the file name with the uploaded file’s own name on upload and on replaceRename the file on disk before uploading; the typed name is kept only for directories
Cannot delete this Directory as it has child directories/filesClient-side guard in Edit FileDelete or move the children first (Parent Directory on each child)
Create Category fails before anything is savedNo label list with code Media_library and type CP_COM exists, so the screen has nothing to attach the category to and never sends itCreate that label list (none is created for you); then retry
Changing Default Branch / Default Location in Settings throws and saves nothingThe Default Selection screen does not work, and nothing in this applet would use either valueNothing to configure; treat both settings screens as inert
Only one of several ticked users is addedSelect Users › Add sends only the last ticked row, and the duplicate check never firesAdd users one at a time
The Manage Users grid shows an internal ID under EmailThe e-mail is never looked upMatch the ID against Tenant Admin’s login list
Drive deleted but its files still appear in searchesDeleting a drive deletes the drive only; its files still point at itDelete the files first, then the drive
not authorised on create, save or deleteMissing API_TNT_DM_FM_DRIVE_* / FILE_* / DRIVE_SUBJECT_* / LABEL_* permission and the login is not a tenant owner or admin. Uploads need FILE_UPDATE, not FILE_CREATEAssign the permission set

Related documentation

  • E-Commerce module — where the file store sits between the back office and the storefront.
  • CP Commerce Admin — the widgets, menu items, posts and facilities that reference drives and files.
Last updated on