Skip to main content

Product permissions

This page lists the Clerk permissions that gate product, barcode, and category actions in the web app, and where each one is enforced: in the UI (Nuxt client) or on the server (Nitro routes under apps/web/server/api).

Permissions in use​

PermissionGatesUI enforcementServer enforcement
org:products:readProduct pages, product listPage meta of apps/web/pages/[client]/products/index.vue and [id].vuePOST /api/products/by-skus, GET /api/products/export
org:products:createCreate and import productsapps/web/pages/[client]/products/new.vue, import-products.vue (<Protect> and page meta)POST /api/products, POST /api/products/bulk, GET /api/products/sku-check, GET /api/products/barcode-check, POST /api/products/:id/barcodes
org:products:editEvery edit of an existing productuseProductAccess (canEdit), [id].vue (canEditProduct)PATCH /api/products/:id, GET /api/products/sku-check, kit, item, level, lock, and variation mutations (see the route table)
org:products:deleteDelete a productindex.vue (<Protect>)DELETE /api/products/:id
org:barcodes:createAdd a barcode[id].vue (canCreateBarcode)POST /api/products/:id/barcodes, GET /api/products/barcode-check
org:barcodes:editEdit a barcode[id].vue (canEditBarcode)PATCH /api/products/:id/barcodes/:barcodeId, GET /api/products/barcode-check
org:barcodes:deleteDelete a barcode[id].vue (canDeleteBarcode)DELETE /api/products/:id/barcodes/:barcodeId
org:categories:readList and resolve categories—GET /api/categories, POST /api/categories/resolve
org:categories:createCreate a categoryProductCommonFields.vue (canCreateCategory), import-products.vuePOST /api/categories

Permission constants for categories are defined in modules/inventory/src/common/domain/permissions/category.permissions.ts.

Removed permissions​

The following permissions are no longer read anywhere in the code. Assigning them has no effect.

PermissionReplaced by
org:products:edit_main_fieldsorg:products:edit
org:products:edit_grupoorg:products:edit
org:products:edit_logistics_fieldsorg:products:edit + organization type + catalog mode (requireLogisticsEdit)
org:products:edit_extendedorg:products:edit (fields); catalog mode setting (catalog tab)

Catalog rule on top of permissions​

Some mutations also require the catalog rule (canEditLogistics in apps/web/utils/products/product-access.ts):

Catalog modeOrganization typeLogistics fields and barcodes on existing products
OFFanyAllowed
ONPARTNERAllowed
ONVENDORRejected

On the server this rule is requireLogisticsEdit in apps/web/server/utils/permissions.ts.

ConditionStatusstatusMessage
Organization cannot be resolved403No se pudo determinar la organización
Rule rejects the caller403Con el catálogo activo, solo usuarios partner pueden modificar campos logísticos

Logistics keys checked on PATCH /api/products/:id are listed in Product field access.

Server route table​

Routes are under apps/web/server/api/. "Catalog rule" means requireLogisticsEdit runs after the permission check.

Products​

Method and routePermissionCatalog rule
GET /api/productsnone—
POST /api/productsorg:products:create—
POST /api/products/bulkorg:products:create—
POST /api/products/by-skusorg:products:read—
GET /api/products/exportorg:products:read—
GET /api/products/kardexnone—
GET /api/products/sku-checkorg:products:create or org:products:edit—
GET /api/products/barcode-checkorg:products:create or org:barcodes:create or org:barcodes:edit—
GET /api/products/:idnone—
PATCH /api/products/:idorg:products:editOnly when the body contains a logistics key
DELETE /api/products/:idorg:products:delete—
GET /api/products/:id/ordersorg:orders:read—
GET /api/products/:id/kardexnone—
GET /api/products/:id/itemsnone—
PATCH, DELETE /api/products/:id/items/:itemIdorg:products:edit—
GET /api/products/:id/kits, GET /api/products/:id/kits/:itemIdnone—
POST /api/products/:id/kits, PATCH, DELETE /api/products/:id/kits/:itemIdorg:products:edit—
GET /api/products/:id/levels, GET /api/products/:id/levels/:levelIdnone—
POST /api/products/:id/levels, PATCH, DELETE /api/products/:id/levels/:levelIdorg:products:edit—
GET /api/products/:id/locksnone—
PATCH /api/products/:id/locks/:lockIdorg:products:edit—
GET /api/products/:id/variationsnone—
POST /api/products/:id/variationsorg:products:edit—

Barcodes​

Method and routePermissionCatalog rule
GET /api/products/:id/barcodesnone—
POST /api/products/:id/barcodesorg:barcodes:create or org:products:createYes, unless the caller has org:products:create
PATCH /api/products/:id/barcodes/:barcodeIdorg:barcodes:editYes
DELETE /api/products/:id/barcodes/:barcodeIdorg:barcodes:deleteYes
POST /api/barcodes/bulknone—

Categories​

Method and routePermission
GET /api/categoriesorg:categories:read
POST /api/categoriesorg:categories:create
POST /api/categories/resolveorg:categories:read

Query parameters and responses are in Categories API.

Organizations​

Method and routePermissionNotes
GET /api/organizations/:idnoneReturns the organization with settings.CATALOG_MODE already merged from the partner (see apps/web/server/utils/organizations/organizationContext.ts).

Barcode actions in the edit page​

In apps/web/pages/[client]/products/[id].vue each barcode action requires its org:barcodes:* permission and the catalog rule. org:products:edit is not required for barcode actions. A user with only barcode permissions sees Guardar cambios; the product PATCH is skipped for them and only new barcodes are created.