]> source.dussan.org Git - nextcloud-server.git/commitdiff
WIP4
authorLouis Chemineau <louis@chmn.me>
Tue, 17 Sep 2024 15:10:18 +0000 (17:10 +0200)
committerLouis Chemineau <louis@chmn.me>
Thu, 3 Oct 2024 13:45:10 +0000 (15:45 +0200)
Signed-off-by: Louis Chemineau <louis@chmn.me>
apps/user_ldap/src/components/SettingsTabs/AdvancedTab.vue
apps/user_ldap/src/components/SettingsTabs/LoginTab.vue
apps/user_ldap/src/models/index.ts
apps/user_ldap/src/services/wizardUtils.ts [new file with mode: 0644]

index 8e3b13b75b87dd063fc6f228e954d1467c2f1ef3..dfb9ec4dfe4991e4c8b6b67f6a6a26752697b694 100644 (file)
@@ -7,9 +7,9 @@
                <summary class="ldap-wizard__advanced__section">
                        <h3>{{ t('user_ldap', 'Connection Settings') }}</h3>
 
-                       <NcCheckboxRadioSwitch :checked.sync="ldapConfig.ldapConfigurationActive"
-                               value="1"
-                               :aria-label="t('user_ldap', 'When unchecked, this configuration will be skipped.')">
+                       <NcCheckboxRadioSwitch :checked="ldapConfig.ldapConfigurationActive === '1'"
+                               :aria-label="t('user_ldap', 'When unchecked, this configuration will be skipped.')"
+                               @update:checked="ldapConfig.ldapConfigurationActive = $event ? '1' : '0'">
                                {{ t('user_ldap', 'Configuration Active') }}
                        </NcCheckboxRadioSwitch>
 
                                :value="ldapConfig.ldapBackupPort"
                                :label="t('user_ldap', 'Backup (Replica) Port') " />
 
-                       <NcCheckboxRadioSwitch :checked.sync="ldapConfig.ldapOverrideMainServer"
-                               value="1"
+                       <NcCheckboxRadioSwitch :checked="ldapConfig.ldapOverrideMainServer === '1'"
                                :aria-label="t('user_ldap', 'Only connect to the replica server.')"
-                               ">
+                               @update:checked="ldapConfig.ldapOverrideMainServer = $event ? '1' : '0'">
                                {{ t('user_ldap', 'Disable Main Server') }}
                        </NcCheckboxRadioSwitch>
 
-                       <NcCheckboxRadioSwitch :checked.sync=" ldapConfig.turnOffCertCheck"
+                       <NcCheckboxRadioSwitch :checked="ldapConfig.turnOffCertCheck === '1'"
                                :aria-label="t('user_ldap', 'Not recommended, use it for testing only! If connection only works with this option, import the LDAP server\'s SSL certificate in your {instanceName} server.', { instanceName })"
-                               value="1">
+                               @update:checked="ldapConfig.turnOffCertCheck = $event ? '1' : '0'">
                                {{ t('user_ldap', 'Turn off SSL certificate validation.') }}
                        </NcCheckboxRadioSwitch>
 
@@ -63,9 +62,9 @@
                                :label="t('user_ldap', 'Base User Tree')"
                                :helper-text="t('user_ldap', 'User Search Attributes')" />
 
-                       <NcCheckboxRadioSwitch :checked.sync="ldapConfig.markRemnantsAsDisabled"
-                               value="1"
-                               :aria-label="t('user_ldap', 'When switched on, users imported from LDAP which are then missing will be disabled')">
+                       <NcCheckboxRadioSwitch :checked="ldapConfig.markRemnantsAsDisabled === '1'"
+                               :aria-label="t('user_ldap', 'When switched on, users imported from LDAP which are then missing will be disabled')"
+                               @update:checked="ldapConfig.markRemnantsAsDisabled = $event ? '1' : '0'">
                                {{ t('user_ldap', 'Disable users missing from LDAP') }}
                        </NcCheckboxRadioSwitch>
 
                                :value.sync="ldapConfig.ldapDynamicGroupMemberURL"
                                :helper-text="t('user_ldap', 'The LDAP attribute that on group objects contains an LDAP search URL that determines what objects belong to the group. (An empty setting disables dynamic group membership functionality.)')" />
 
-                       <NcCheckboxRadioSwitch :checked.sync="ldapConfig.ldapNestedGroups"
-                               value="1"
-                               :aria-label="t('user_ldap', 'When switched on, groups that contain groups are supported. (Only works if the group member attribute contains DNs.)')">
+                       <NcCheckboxRadioSwitch :checked="ldapConfig.ldapNestedGroups === '1'"
+                               :aria-label="t('user_ldap', 'When switched on, groups that contain groups are supported. (Only works if the group member attribute contains DNs.)')"
+                               @update:checked="ldapConfig.ldapNestedGroups = $event ? '1' : '0'">
                                {{ t('user_ldap', 'Nested Groups') }}
                        </NcCheckboxRadioSwitch>
 
                                :value.sync="ldapConfig.ldapPagingSize"
                                :helper-text="t('user_ldap', 'Chunksize used for paged LDAP searches that may return bulky results like user or group enumeration. (Setting it 0 disables paged LDAP searches in those situations.)')" />
 
-                       <NcCheckboxRadioSwitch :checked.sync="ldapConfig.turnOnPasswordChange"
-                               value="1"
-                               :aria-label="t('user_ldap', 'Allow LDAP users to change their password and allow Super Administrators and Group Administrators to change the password of their LDAP users. Only works when access control policies are configured accordingly on the LDAP server. As passwords are sent in plaintext to the LDAP server, transport encryption must be used and password hashing should be configured on the LDAP server.')">
+                       <NcCheckboxRadioSwitch :checked="ldapConfig.turnOnPasswordChange === '1'"
+                               :aria-label="t('user_ldap', 'Allow LDAP users to change their password and allow Super Administrators and Group Administrators to change the password of their LDAP users. Only works when access control policies are configured accordingly on the LDAP server. As passwords are sent in plaintext to the LDAP server, transport encryption must be used and password hashing should be configured on the LDAP server.')"
+                               @update:checked="ldapConfig.turnOnPasswordChange = $event ? '1' : '0'">
                                {{ t('user_ldap', 'Enable LDAP password changes per user') }}
                        </NcCheckboxRadioSwitch>
                        <span class="tablecell">
index cdbaa24714e0cc7e2d0d6fad5ee248cdb24d32d1..ed6de013b7377d680b8ec6352119e7a87f8c2442 100644 (file)
@@ -7,13 +7,15 @@
                {{ t('user_ldap', 'When logging in, {instanceName} will find the user based on the following attributes:', { instanceName }) }}
 
                <div class="ldap-wizard__login__line ldap-wizard__login__login-attributes">
-                       <NcCheckboxRadioSwitch :checked.sync="ldapConfig.ldapAgentName"
-                               :aria-label="t('user_ldap', 'Allows login against the LDAP/AD username, which is either `uid` or `sAMAccountName` and will be detected.')">
+                       <NcCheckboxRadioSwitch :checked="ldapConfig.ldapAgentName === '1'"
+                               :aria-label="t('user_ldap', 'Allows login against the LDAP/AD username, which is either `uid` or `sAMAccountName` and will be detected.')"
+                               @update:checked="ldapConfig.ldapAgentName = $event ? '1' : '0'">
                                {{ t('user_ldap', 'LDAP/AD Username') }}
                        </NcCheckboxRadioSwitch>
 
-                       <NcCheckboxRadioSwitch :checked.sync="ldapConfig.ldapLoginFilterEmail"
-                               :aria-label="t('user_ldap', 'Allows login against an email attribute. `mail` and `mailPrimaryAddress` allowed.')">
+                       <NcCheckboxRadioSwitch :checked="ldapConfig.ldapLoginFilterEmail === '1'"
+                               :aria-label="t('user_ldap', 'Allows login against an email attribute. `mail` and `mailPrimaryAddress` allowed.')"
+                               @update:checked="ldapConfig.ldapLoginFilterEmail = $event ? '1' : '0'">
                                {{ t('user_ldap', 'LDAP/AD Email Address') }}
                        </NcCheckboxRadioSwitch>
 
index 5b548c6ae2b3c0e78d78f6a90e1530009b915555..632b43e44e84226881c57f5e4e321100f2608f19 100644 (file)
@@ -13,25 +13,25 @@ export type LDAPConfig = {
        ldapBaseGroups: string // Example: ou=small,dc=my,dc=ldap,dc=server
        ldapAgentName: string // Example: cn=root,dc=my,dc=ldap,dc=server
        ldapAgentPassword: string // Example: clearTextWithShowPassword=1
-       ldapTLS: string // Example: 1
-       turnOffCertCheck: string // Example: 0
+       ldapTLS: '0'|'1' // Example: 1
+       turnOffCertCheck: '0'|'1' // Example: 0
        ldapIgnoreNamingRules: string // Example: >
        ldapUserDisplayName: string // Example: displayname
        ldapUserDisplayName2: string // Example: uid
        ldapUserFilterObjectclass: string // Example: inetOrgPerson
        ldapUserFilterGroups: string
        ldapUserFilter: string // Example: (&amp;(objectclass=nextcloudUser)(nextcloudEnabled=TRUE))
-       ldapUserFilterMode: string // Example: 1
+       ldapUserFilterMode: '0'|'1' // Example: 1
        ldapGroupFilter: string // Example: (&amp;(|(objectclass=nextcloudGroup)))
-       ldapGroupFilterMode: string // Example: 0
+       ldapGroupFilterMode: '0'|'1' // Example: 0
        ldapGroupFilterObjectclass: string // Example: nextcloudGroup
        ldapGroupFilterGroups: string
        ldapGroupDisplayName: string // Example: cn
        ldapGroupMemberAssocAttr: string // Example: memberUid
        ldapLoginFilter: string // Example: (&amp;(|(objectclass=inetOrgPerson))(uid=%uid))
-       ldapLoginFilterMode: string // Example: 0
-       ldapLoginFilterEmail: string // Example: 0
-       ldapLoginFilterUsername: string // Example: 1
+       ldapLoginFilterMode: '0'|'1' // Example: 0
+       ldapLoginFilterEmail: '0'|'1' // Example: 0
+       ldapLoginFilterUsername: '0'|'1' // Example: 1
        ldapLoginFilterAttributes: string
        ldapQuotaAttribute: string
        ldapQuotaDefault: string
@@ -40,22 +40,22 @@ export type LDAPConfig = {
        ldapUuidUserAttribute: string // Example: auto
        ldapUuidGroupAttribute: string // Example: auto
        ldapOverrideMainServer: string
-       ldapConfigurationActive: string // Example: 1
+       ldapConfigurationActive: '0'|'1' // Example: 1
        ldapAttributesForUserSearch: string // Example: uid;sn;givenname
        ldapAttributesForGroupSearch: string
-       ldapExperiencedAdmin: string // Example: 0
+       ldapExperiencedAdmin: '0'|'1' // Example: 0
        homeFolderNamingRule: string
        hasMemberOfFilterSupport: string
-       useMemberOfToDetectMembership: string // Example: 1
+       useMemberOfToDetectMembership: '0'|'1' // Example: 1
        ldapExpertUsernameAttr: string // Example: uid
        ldapExpertUUIDUserAttr: string // Example: uid
        ldapExpertUUIDGroupAttr: string
-       lastJpegPhotoLookup: string // Example: 0
-       ldapNestedGroups: string // Example: 0
+       lastJpegPhotoLookup: '0'|'1' // Example: 0
+       ldapNestedGroups: '0'|'1' // Example: 0
        ldapPagingSize: string // Example: 500
-       turnOnPasswordChange: string // Example: 1
+       turnOnPasswordChange: '0'|'1' // Example: 1
        ldapDynamicGroupMemberURL: string
-       markRemnantsAsDisabled: string // Example: 1
+       markRemnantsAsDisabled: '0'|'1' // Example: 1
        ldapDefaultPPolicyDN: string
        ldapExtStorageHomeAttribute: string
        ldapAttributePhone: string
diff --git a/apps/user_ldap/src/services/wizardUtils.ts b/apps/user_ldap/src/services/wizardUtils.ts
new file mode 100644 (file)
index 0000000..79c6ee6
--- /dev/null
@@ -0,0 +1,10 @@
+               /**
+                * starts a configuration test on the Nextcloud server
+                */
+               requestConfigurationTest: function() {
+                       var url = OC.generateUrl('apps/user_ldap/ajax/testConfiguration.php');
+                       var params = OC.buildQueryString({ldap_serverconfig_chooser: this.configID});
+                       var model = this;
+                       $.post(url, params, function(result) { model._processTestResult(model, result) });
+                       //TODO: make sure only one test is running at a time
+               },
\ No newline at end of file