Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ui/src/__tests__/plugin-id.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ describe('plugin-id contract', () => {
'/id/user',
'/id/group', '/id/group/new', '/id/group/:id',
'/id/company', '/id/company/new', '/id/company/:id',
'/id/delegate', '/id/delegate/new', '/id/delegate/:id',
// Delegates likewise edit through a dialog (DelegateEditDialog,
// chantier D3), so /id/delegate/new and /id/delegate/:id are
// no longer routes either.
'/id/delegate',
'/id/container-scope',
// Subscription-scoped group members view (legacy id.html port).
'/id/subscription/:id',
]))
expect(registered).toHaveLength(12)
expect(registered).toHaveLength(10)
})

it('feature("renderFeatures") returns VNodes the host can mount', () => {
Expand Down
46 changes: 46 additions & 0 deletions ui/src/composables/delegateTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Shared type catalog for delegations. Used by:
// - DelegateEditDialog: drives the v-select items for receiver/resource
// types and the prepend-inner-icon shown on the selected value.
// - DelegateListView: maps the raw enum value to a row icon in the
// Receiver and Resource columns (chantier D5+D8).
//
// The previous inline copy in DelegateEditView would have drifted as soon
// as the list started rendering icons too; this module is the single
// source of truth.

import { computed } from 'vue'

// Raw-enum-keyed icon map. Const at module scope so it's never re-created
// reactively — both the #item slot (dropdown rows) and the
// prepend-inner-icon computed reference the same object.
export const TYPE_ICONS = {
USER: 'mdi-account',
GROUP: 'mdi-account-group',
COMPANY: 'mdi-domain',
TREE: 'mdi-file-tree',
}

// Receivers cannot be a TREE — only USER / GROUP / COMPANY can hold a
// delegation. Items are plain objects with the raw enum value + an i18n
// key the caller resolves via t() (kept out of this module so the
// composable stays test-friendly).
export const RECEIVER_TYPES = [
{ value: 'USER', titleKey: 'delegate.type.user' },
{ value: 'GROUP', titleKey: 'delegate.type.group' },
{ value: 'COMPANY', titleKey: 'delegate.type.company' },
]

// Resources can additionally be a TREE (LDAP subtree DN).
export const RESOURCE_TYPES = [
{ value: 'USER', titleKey: 'delegate.type.user' },
{ value: 'GROUP', titleKey: 'delegate.type.group' },
{ value: 'COMPANY', titleKey: 'delegate.type.company' },
{ value: 'TREE', titleKey: 'delegate.type.tree' },
]

// Reactive icon helper: pass a ref/computed that yields the current enum
// value and get back a computed yielding the matching MDI string (empty
// if the value is unknown).
export function useTypeIcon(valueRef) {
return computed(() => TYPE_ICONS[valueRef.value] || '')
}
6 changes: 6 additions & 0 deletions ui/src/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export default {
'delegate.type.company': 'Company',
'delegate.type.tree': 'Tree',
'delegate.resourceDnHint': 'LDAP DN of the subtree (e.g. ou=project,dc=acme,dc=com)',
// Chantier D7 — labels and help text for the Admin/Write security
// levels in the delegate dialog. Mirrors the legacy plugin-id wording.
'delegate.admin': 'Administration',
'delegate.write': 'Write',
'delegate.adminHelp': 'With the administration security level on this resource, the receivers of this delegation can create other delegations to share this access with other valid receivers',
'delegate.writeHelp': 'With the write security level, the receivers of this delegation can modify the members of the involved groups. Without this access, this delegation grants read-only rights',
'user.deleteConfirmBefore': 'Are you sure you want to delete ',
'user.deleteConfirmAfter': '?',
'group.deleteConfirmBefore': 'Are you sure you want to delete ',
Expand Down
6 changes: 6 additions & 0 deletions ui/src/i18n/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ export default {
'delegate.type.company': 'Entité',
'delegate.type.tree': 'Arborescence',
'delegate.resourceDnHint': 'DN LDAP du sous-arbre (ex. ou=project,dc=acme,dc=com)',
// Chantier D7 — libellés et aides pour les niveaux de sécurité Admin/Write
// du dialog de délégation. Textes récupérés du plugin-id legacy.
'delegate.admin': 'Administration',
'delegate.write': 'Écriture',
'delegate.adminHelp': 'Avec le niveau de sécurité d\'administration sur cette ressource, les receveurs de cette délégation peuvent créer d\'autres délégations pour partager cet accès avec d\'autres receveurs valides',
'delegate.writeHelp': 'Avec le niveau de sécurité d\'écriture, les receveurs de cette délégation peuvent modifier les membres des groupes impliqués. Sans cet accès cette délégation ne donne qu\'un droit de lecture',
'user.deleteConfirmBefore': 'Êtes-vous certain de supprimer ',
'user.deleteConfirmAfter': ' ?',
'group.deleteConfirmBefore': 'Êtes-vous certain de supprimer ',
Expand Down
5 changes: 2 additions & 3 deletions ui/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import GroupEditView from './views/GroupEditView.vue'
import CompanyListView from './views/CompanyListView.vue'
import CompanyEditView from './views/CompanyEditView.vue'
import DelegateListView from './views/DelegateListView.vue'
import DelegateEditView from './views/DelegateEditView.vue'
import ContainerScopeView from './views/ContainerScopeView.vue'
import GroupMembersView from './views/GroupMembersView.vue'
import enMessages from './i18n/en.js'
Expand Down Expand Up @@ -72,9 +71,9 @@ const routes = [
{ path: '/id/company', name: 'id-company', component: CompanyListView },
{ path: '/id/company/new', name: 'id-company-new', component: CompanyEditView },
{ path: '/id/company/:id', name: 'id-company-edit', component: CompanyEditView },
// Delegate create/edit is a dialog hosted by DelegateListView (chantier D3),
// so there is no per-entity delegate route — mirrors the Users screen.
{ path: '/id/delegate', name: 'id-delegate', component: DelegateListView },
{ path: '/id/delegate/new', name: 'id-delegate-new', component: DelegateEditView },
{ path: '/id/delegate/:id', name: 'id-delegate-edit', component: DelegateEditView },
{ path: '/id/container-scope', name: 'id-container-scope', component: ContainerScopeView },
// Per-subscription configuration view (ported from the legacy
// `service/id/id.html`): lists group members, lets the user add
Expand Down
Loading
Loading