mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-22 08:06:42 +00:00
feat: add stack:read permission gate to Settings Labels section (#1747)
The Labels section registry entry had no requiredPermission, leaving it
visible to every authenticated operator. The backend already enforces
stack:read on GET and stack:edit on write endpoints, and the frontend
component already hides edit controls behind can('stack:edit'). Adding
stack:read to the registry declares the contract explicitly.
All five built-in roles hold stack:read, so this has no observable
effect on current users. It becomes a functioning gate automatically
if a future role or scoped user type is introduced without the permission.
This commit is contained in:
@@ -156,6 +156,7 @@ describe('requiredPermission registry mapping', () => {
|
|||||||
expect(byId.get('developer')?.requiredPermission).toBe('system:settings');
|
expect(byId.get('developer')?.requiredPermission).toBe('system:settings');
|
||||||
expect(byId.get('data-retention')?.requiredPermission).toBe('system:settings');
|
expect(byId.get('data-retention')?.requiredPermission).toBe('system:settings');
|
||||||
expect(byId.get('image-updates')?.requiredPermission).toBe('system:settings');
|
expect(byId.get('image-updates')?.requiredPermission).toBe('system:settings');
|
||||||
|
expect(byId.get('labels')?.requiredPermission).toBe('stack:read');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('keeps adminOnly on identity, credentials, and emergency surfaces', () => {
|
it('keeps adminOnly on identity, credentials, and emergency surfaces', () => {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ describe('settings section visibility by role', () => {
|
|||||||
'registries',
|
'registries',
|
||||||
'webhooks',
|
'webhooks',
|
||||||
'nodes',
|
'nodes',
|
||||||
|
'labels',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
it('shows permission-gated sections only to roles that hold the permission', () => {
|
it('shows permission-gated sections only to roles that hold the permission', () => {
|
||||||
|
|||||||
@@ -267,6 +267,7 @@ export const SETTINGS_ITEMS: readonly SettingsItemMeta[] = [
|
|||||||
keywords: ['labels', 'tags', 'palette', 'organisation'],
|
keywords: ['labels', 'tags', 'palette', 'organisation'],
|
||||||
tier: null,
|
tier: null,
|
||||||
scope: 'node',
|
scope: 'node',
|
||||||
|
requiredPermission: 'stack:read',
|
||||||
},
|
},
|
||||||
// Operations
|
// Operations
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user