Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2dea21a
chore: Get rid of unused user_ldap AJAX endpoints
come-nc Oct 2, 2025
e842874
fix(user_ldap): Add OCS endpoint for testing configurations
come-nc Oct 2, 2025
36475f2
fix(user_ldap): Add OCS endpoint for copying configurations
come-nc Oct 2, 2025
a0e5548
feat(user_ldap): Add a wizard OCS API
come-nc Oct 2, 2025
777c729
feat(user_ldap): Adapt frontend to call new endpoints
artonge Oct 2, 2025
9d41d81
fix(ldap): Fix wizard controller action route
come-nc Oct 6, 2025
ac078b6
chore: Fix typing in WizardResult
come-nc Oct 7, 2025
c414a7b
fix: Fix documentation for controllers and update openapi.json
come-nc Oct 7, 2025
28cef3e
fix(ldap): Add OCS route for clearing mapping without using ajax
come-nc Oct 7, 2025
c621662
chore(user_ldap): Remove ajax endpoints
come-nc Oct 7, 2025
aed0e82
fix(user_ldap): Remove last ajax call from frontend
come-nc Oct 7, 2025
92efa01
chore: Update psalm baseline
come-nc Oct 7, 2025
f9abfe0
fix(tests): Use testing application for testing ajax endpoints, not u…
come-nc Oct 7, 2025
00349e6
chore: npm run lint:fix
come-nc Oct 7, 2025
1afa2a5
chore: remove unused imports
come-nc Oct 7, 2025
687fa0a
fix(user_ldap): Call config API instead of wizard save action
come-nc Oct 7, 2025
3906998
feat(user_ldap): Save base on detect
artonge Nov 21, 2025
f57fb6e
feat(user_ldap): Disable countInBaseDN button when base is empty
artonge Nov 21, 2025
ac690ea
fix(user_ldap): Properly handle new wizard OCS endpoint error
artonge Nov 21, 2025
e9b1e7a
chore: Compile assets
artonge Nov 21, 2025
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
Prev Previous commit
Next Next commit
feat(user_ldap): Adapt frontend to call new endpoints
Signed-off-by: Louis Chemineau <[email protected]>
Signed-off-by: Louis Chmn <[email protected]>
  • Loading branch information
artonge committed Nov 21, 2025
commit 777c729f688ecc939d86e8098a44fb83db8e3b8a
2 changes: 2 additions & 0 deletions apps/user_ldap/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'OCA\\User_LDAP\\ConnectionFactory' => $baseDir . '/../lib/ConnectionFactory.php',
'OCA\\User_LDAP\\Controller\\ConfigAPIController' => $baseDir . '/../lib/Controller/ConfigAPIController.php',
'OCA\\User_LDAP\\Controller\\RenewPasswordController' => $baseDir . '/../lib/Controller/RenewPasswordController.php',
'OCA\\User_LDAP\\Controller\\WizardController' => $baseDir . '/../lib/Controller/WizardController.php',
'OCA\\User_LDAP\\DataCollector\\LdapDataCollector' => $baseDir . '/../lib/DataCollector/LdapDataCollector.php',
'OCA\\User_LDAP\\Db\\GroupMembership' => $baseDir . '/../lib/Db/GroupMembership.php',
'OCA\\User_LDAP\\Db\\GroupMembershipMapper' => $baseDir . '/../lib/Db/GroupMembershipMapper.php',
Expand Down Expand Up @@ -95,5 +96,6 @@
'OCA\\User_LDAP\\User_LDAP' => $baseDir . '/../lib/User_LDAP.php',
'OCA\\User_LDAP\\User_Proxy' => $baseDir . '/../lib/User_Proxy.php',
'OCA\\User_LDAP\\Wizard' => $baseDir . '/../lib/Wizard.php',
'OCA\\User_LDAP\\WizardFactory' => $baseDir . '/../lib/WizardFactory.php',
'OCA\\User_LDAP\\WizardResult' => $baseDir . '/../lib/WizardResult.php',
);
2 changes: 2 additions & 0 deletions apps/user_ldap/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class ComposerStaticInitUser_LDAP
'OCA\\User_LDAP\\ConnectionFactory' => __DIR__ . '/..' . '/../lib/ConnectionFactory.php',
'OCA\\User_LDAP\\Controller\\ConfigAPIController' => __DIR__ . '/..' . '/../lib/Controller/ConfigAPIController.php',
'OCA\\User_LDAP\\Controller\\RenewPasswordController' => __DIR__ . '/..' . '/../lib/Controller/RenewPasswordController.php',
'OCA\\User_LDAP\\Controller\\WizardController' => __DIR__ . '/..' . '/../lib/Controller/WizardController.php',
'OCA\\User_LDAP\\DataCollector\\LdapDataCollector' => __DIR__ . '/..' . '/../lib/DataCollector/LdapDataCollector.php',
'OCA\\User_LDAP\\Db\\GroupMembership' => __DIR__ . '/..' . '/../lib/Db/GroupMembership.php',
'OCA\\User_LDAP\\Db\\GroupMembershipMapper' => __DIR__ . '/..' . '/../lib/Db/GroupMembershipMapper.php',
Expand Down Expand Up @@ -110,6 +111,7 @@ class ComposerStaticInitUser_LDAP
'OCA\\User_LDAP\\User_LDAP' => __DIR__ . '/..' . '/../lib/User_LDAP.php',
'OCA\\User_LDAP\\User_Proxy' => __DIR__ . '/..' . '/../lib/User_Proxy.php',
'OCA\\User_LDAP\\Wizard' => __DIR__ . '/..' . '/../lib/Wizard.php',
'OCA\\User_LDAP\\WizardFactory' => __DIR__ . '/..' . '/../lib/WizardFactory.php',
'OCA\\User_LDAP\\WizardResult' => __DIR__ . '/..' . '/../lib/WizardResult.php',
);

Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/src/components/SettingsTabs/LoginTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async function getUserLoginFilter() {
*/
async function verifyLoginName() {
try {
const response = await callWizard('testLoginName', props.configId, { ldap_test_loginname: testUsername.value })
const response = await callWizard('testLoginName', props.configId, { loginName: testUsername.value })

const testLoginName = response.changes!.ldap_test_loginname as number
const testEffectiveFilter = response.changes!.ldap_test_effective_filter as string
Expand Down
4 changes: 2 additions & 2 deletions apps/user_ldap/src/components/WizardControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ const ldapConfigsStore = useLDAPConfigsStore()
const { updatingConfig } = storeToRefs(ldapConfigsStore)

const loading = ref(false)
const result = ref<{ message: string, status: 'error' | 'success' } | null>(null)
const isValide = computed(() => result.value?.status === 'success')
const result = ref<{ success: boolean, message: string } | null>(null)
const isValide = computed(() => result.value?.success)

watch(updatingConfig, () => {
result.value = null
Expand Down
30 changes: 13 additions & 17 deletions apps/user_ldap/src/services/ldapConfigService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ export async function copyConfig(configId: string) {
params.set('copyConfig', configId)

const response = await axios.post(
path.join(AJAX_ENDPOINT, 'getNewServerConfigPrefix.php'),
generateOcsUrl('apps/user_ldap/api/v1/config/{configId}/copy', { configId }),
params,
) as AxiosResponse<{ status: 'error' | 'success', configPrefix: string }>
) as AxiosResponse<OCSResponse<{ configID: string }>>

logger.debug('Created configuration', { configId: response.data.configPrefix })
return response.data.configPrefix
logger.debug('Created configuration', { configId: response.data.ocs.data.configID })
return response.data.ocs.data.configID
}

/**
Expand Down Expand Up @@ -119,16 +119,14 @@ export async function deleteConfig(configId: string): Promise<boolean> {
*/
export async function testConfiguration(configId: string) {
const params = new FormData()
params.set('ldap_serverconfig_chooser', configId)

const response = await axios.post(
path.join(AJAX_ENDPOINT, 'testConfiguration.php'),
params,
) as AxiosResponse<{ message: string, status: 'error' | 'success' }>
generateOcsUrl('apps/user_ldap/api/v1/config/{configId}/test', { configId }),
) as AxiosResponse<OCSResponse<{ success: boolean, message: string }>>

logger.debug(`Configuration is ${response.data.status === 'success' ? 'valide' : 'invalide'}`, { configId, params, response })
logger.debug(`Configuration is ${response.data.ocs.data.success ? 'valide' : 'invalide'}`, { configId, params, response })

return response.data
return response.data.ocs.data
}

/**
Expand Down Expand Up @@ -168,27 +166,25 @@ export async function clearMapping(subject: 'user' | 'group') {
*/
export async function callWizard(action: WizardAction, configId: string, extraParams: Record<string, string> = {}) {
const params = new FormData()
params.set('action', action)
params.set('ldap_serverconfig_chooser', configId)

Object.entries(extraParams).forEach(([key, value]) => {
params.set(key, value)
})

const response = await axios.post(
path.join(AJAX_ENDPOINT, 'wizard.php'),
generateOcsUrl('apps/user_ldap/api/v1/wizard/{configId}/{action}', { configId, action }),
params,
) as AxiosResponse<{ status: 'error', message?: string } | { status: 'success', changes?: Record<string, unknown>, options?: Record<string, []> }>
) as AxiosResponse<OCSResponse<{ changes?: Record<string, unknown>, options?: Record<string, []> }>>

logger.debug(`Called wizard action: ${action}`, { configId, params, response })

if (response.data.status === 'error') {
const message = response.data.message ?? t('user_ldap', 'An error occurred')
if (response.data.ocs.meta.status === 'failure') {
const message = response.data.ocs.meta.message ?? t('user_ldap', 'An error occurred')
showError(message)
throw new Error(message)
}

return response.data
return response.data.ocs.data
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/src/store/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const useLDAPConfigsStore = defineStore('ldap-configs', () => {

;(async () => {
updatingConfig.value++
await callWizard('save', configId, { cfgkey: property, cfgval: newValue })
await callWizard('save', configId, { key: property, val: newValue })
updatingConfig.value--

if (postSetHooks[property] !== undefined) {
Expand Down