Add separate permission for AMS RFID re-read (Issue #204)

- Add new `printers:ams_rfid` permission for re-reading AMS RFID tags
- Allows granting RFID re-read access without full printer control
- Operators group includes this permission by default
- Previously used `printers:control` which grants broader access
- Permission available in Settings > Users > Group Editor

Closes #204
This commit is contained in:
maziggy
2026-02-01 11:39:37 +01:00
parent d715132a84
commit ade4792eac
7 changed files with 20 additions and 12 deletions
+1 -1
View File
@@ -1727,7 +1727,7 @@ export interface ExternalLinkUpdate {
// Permission type - all available permissions
export type Permission =
| 'printers:read' | 'printers:create' | 'printers:update' | 'printers:delete' | 'printers:control' | 'printers:files'
| 'printers:read' | 'printers:create' | 'printers:update' | 'printers:delete' | 'printers:control' | 'printers:files' | 'printers:ams_rfid'
| 'archives:read' | 'archives:create'
| 'archives:update_own' | 'archives:update_all' | 'archives:delete_own' | 'archives:delete_all'
| 'archives:reprint_own' | 'archives:reprint_all'
+8 -8
View File
@@ -2291,18 +2291,18 @@ function PrinterCard({
<div className="absolute top-full left-0 mt-1 z-50 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 min-w-[120px]">
<button
className={`w-full px-3 py-1.5 text-left text-xs flex items-center gap-2 ${
hasPermission('printers:control')
hasPermission('printers:ams_rfid')
? 'text-white hover:bg-bambu-dark-tertiary'
: 'text-bambu-gray/50 cursor-not-allowed'
}`}
onClick={(e) => {
e.stopPropagation();
if (!hasPermission('printers:control')) return;
if (!hasPermission('printers:ams_rfid')) return;
refreshAmsSlotMutation.mutate({ amsId: ams.id, slotId: slotIdx });
setAmsSlotMenu(null);
}}
disabled={isRefreshing || !hasPermission('printers:control')}
title={!hasPermission('printers:control') ? 'You do not have permission to control printers' : undefined}
disabled={isRefreshing || !hasPermission('printers:ams_rfid')}
title={!hasPermission('printers:ams_rfid') ? 'You do not have permission to re-read AMS RFID' : undefined}
>
<RefreshCw className={`w-3 h-3 ${isRefreshing ? 'animate-spin' : ''}`} />
Re-read RFID
@@ -2480,18 +2480,18 @@ function PrinterCard({
<div className="absolute top-full left-0 mt-1 z-50 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 min-w-[120px]">
<button
className={`w-full px-3 py-1.5 text-left text-xs flex items-center gap-2 ${
hasPermission('printers:control')
hasPermission('printers:ams_rfid')
? 'text-white hover:bg-bambu-dark-tertiary'
: 'text-bambu-gray/50 cursor-not-allowed'
}`}
onClick={(e) => {
e.stopPropagation();
if (!hasPermission('printers:control')) return;
if (!hasPermission('printers:ams_rfid')) return;
refreshAmsSlotMutation.mutate({ amsId: ams.id, slotId: htSlotId });
setAmsSlotMenu(null);
}}
disabled={isHtRefreshing || !hasPermission('printers:control')}
title={!hasPermission('printers:control') ? 'You do not have permission to control printers' : undefined}
disabled={isHtRefreshing || !hasPermission('printers:ams_rfid')}
title={!hasPermission('printers:ams_rfid') ? 'You do not have permission to re-read AMS RFID' : undefined}
>
<RefreshCw className={`w-3 h-3 ${isHtRefreshing ? 'animate-spin' : ''}`} />
Re-read RFID