123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527 |
- /**
- * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
- OCA = OCA || {};
- (function() {
- /**
- * @classdesc This class represents the view belonging to the advanced tab
- * in the LDAP wizard.
- */
- var WizardTabAdvanced = OCA.LDAP.Wizard.WizardTabGeneric.subClass({
- /**
- * initializes the instance. Always call it after initialization.
- *
- * @param {any} tabIndex -
- * @param {any} tabID -
- */
- init: function (tabIndex, tabID) {
- this._super(tabIndex, tabID);
- var items = {
- // Connection settings
- ldap_configuration_active: {
- $element: $('#ldap_configuration_active'),
- setMethod: 'setConfigurationState'
- },
- ldap_backup_host: {
- $element: $('#ldap_backup_host'),
- setMethod: 'setBackupHost'
- },
- ldap_backup_port: {
- $element: $('#ldap_backup_port'),
- setMethod: 'setBackupPort'
- },
- ldap_override_main_server: {
- $element: $('#ldap_override_main_server'),
- setMethod: 'setOverrideMainServerState'
- },
- ldap_turn_off_cert_check: {
- $element: $('#ldap_turn_off_cert_check'),
- setMethod: 'setCertCheckDisabled'
- },
- ldap_cache_ttl: {
- $element: $('#ldap_cache_ttl'),
- setMethod: 'setCacheTTL'
- },
- //Directory Settings
- ldap_display_name: {
- $element: $('#ldap_display_name'),
- setMethod: 'setUserDisplayName'
- },
- ldap_user_display_name_2: {
- $element: $('#ldap_user_display_name_2'),
- setMethod: 'setUserDisplayName2'
- },
- ldap_base_users: {
- $element: $('#ldap_base_users'),
- setMethod: 'setBaseDNUsers'
- },
- ldap_attributes_for_user_search: {
- $element: $('#ldap_attributes_for_user_search'),
- setMethod: 'setSearchAttributesUsers'
- },
- ldap_mark_remnants_as_disabled: {
- $element: $('#ldap_mark_remnants_as_disabled'),
- setMethod: 'setMarkRemnantsAsDisabled'
- },
- ldap_group_display_name: {
- $element: $('#ldap_group_display_name'),
- setMethod: 'setGroupDisplayName'
- },
- ldap_base_groups: {
- $element: $('#ldap_base_groups'),
- setMethod: 'setBaseDNGroups'
- },
- ldap_attributes_for_group_search: {
- $element: $('#ldap_attributes_for_group_search'),
- setMethod: 'setSearchAttributesGroups'
- },
- ldap_group_member_assoc_attribute: {
- $element: $('#ldap_group_member_assoc_attribute'),
- setMethod: 'setGroupMemberAssociationAttribute'
- },
- ldap_dynamic_group_member_url: {
- $element: $('#ldap_dynamic_group_member_url'),
- setMethod: 'setDynamicGroupMemberURL'
- },
- ldap_nested_groups: {
- $element: $('#ldap_nested_groups'),
- setMethod: 'setUseNestedGroups'
- },
- ldap_paging_size: {
- $element: $('#ldap_paging_size'),
- setMethod: 'setPagingSize'
- },
- ldap_turn_on_pwd_change: {
- $element: $('#ldap_turn_on_pwd_change'),
- setMethod: 'setPasswordChangeEnabled'
- },
- ldap_default_ppolicy_dn: {
- $element: $('#ldap_default_ppolicy_dn'),
- setMethod: 'setDefaultPPolicyDN'
- },
- //Special Attributes
- ldap_quota_attr: {
- $element: $('#ldap_quota_attr'),
- setMethod: 'setQuotaAttribute'
- },
- ldap_quota_def: {
- $element: $('#ldap_quota_def'),
- setMethod: 'setQuotaDefault'
- },
- ldap_email_attr: {
- $element: $('#ldap_email_attr'),
- setMethod: 'setEmailAttribute'
- },
- home_folder_naming_rule: {
- $element: $('#home_folder_naming_rule'),
- setMethod: 'setHomeFolderAttribute'
- },
- ldap_ext_storage_home_attribute: {
- $element: $('#ldap_ext_storage_home_attribute'),
- setMethod: 'setExternalStorageHomeAttribute'
- },
- //User Profile Attributes
- ldap_attr_phone: {
- $element: $('#ldap_attr_phone'),
- setMethod: 'setPhoneAttribute'
- },
- ldap_attr_website: {
- $element: $('#ldap_attr_website'),
- setMethod: 'setWebsiteAttribute'
- },
- ldap_attr_address: {
- $element: $('#ldap_attr_address'),
- setMethod: 'setAddressAttribute'
- },
- ldap_attr_twitter: {
- $element: $('#ldap_attr_twitter'),
- setMethod: 'setTwitterAttribute'
- },
- ldap_attr_fediverse: {
- $element: $('#ldap_attr_fediverse'),
- setMethod: 'setFediverseAttribute'
- },
- ldap_attr_organisation: {
- $element: $('#ldap_attr_organisation'),
- setMethod: 'setOrganisationAttribute'
- },
- ldap_attr_role: {
- $element: $('#ldap_attr_role'),
- setMethod: 'setRoleAttribute'
- },
- ldap_attr_headline: {
- $element: $('#ldap_attr_headline'),
- setMethod: 'setHeadlineAttribute'
- },
- ldap_attr_biography: {
- $element: $('#ldap_attr_biography'),
- setMethod: 'setBiographyAttribute'
- },
- ldap_attr_birthdate: {
- $element: $('#ldap_attr_birthdate'),
- setMethod: 'setBirthdateAttribute'
- },
- };
- this.setManagedItems(items);
- },
- /**
- * Sets the config model for this view and subscribes to some events.
- * Also binds the config chooser to the model
- *
- * @param {OCA.LDAP.Wizard.ConfigModel} configModel
- */
- setModel: function(configModel) {
- this._super(configModel);
- this.configModel.on('configLoaded', this.onConfigLoaded, this);
- this.configModel.on('receivedLdapFeature', this.onResultReceived, this);
- },
- /**
- * updates the experienced admin check box
- *
- * @param {string} isConfigActive contains an int
- */
- setConfigurationState: function(isConfigActive) {
- this.setElementValue(
- this.managedItems.ldap_configuration_active.$element, isConfigActive
- );
- },
- /**
- * updates the backup host configuration text field
- *
- * @param {string} host
- */
- setBackupHost: function(host) {
- this.setElementValue(this.managedItems.ldap_backup_host.$element, host);
- },
- /**
- * updates the backup port configuration text field
- *
- * @param {string} port
- */
- setBackupPort: function(port) {
- this.setElementValue(this.managedItems.ldap_backup_port.$element, port);
- },
- /**
- * sets whether the main server should be overridden or not
- *
- * @param {string} doOverride contains an int
- */
- setOverrideMainServerState: function(doOverride) {
- this.setElementValue(
- this.managedItems.ldap_override_main_server.$element, doOverride
- );
- },
- /**
- * sets whether the SSL/TLS certification check shout be disabled
- *
- * @param {string} doCertCheck contains an int
- */
- setCertCheckDisabled: function(doCertCheck) {
- this.setElementValue(
- this.managedItems.ldap_turn_off_cert_check.$element, doCertCheck
- );
- },
- /**
- * sets the time-to-live of the LDAP cache (in seconds)
- *
- * @param {string} cacheTTL contains an int
- */
- setCacheTTL: function(cacheTTL) {
- this.setElementValue(this.managedItems.ldap_cache_ttl.$element, cacheTTL);
- },
- /**
- * sets the user display name attribute
- *
- * @param {string} attribute
- */
- setUserDisplayName: function(attribute) {
- this.setElementValue(this.managedItems.ldap_display_name.$element, attribute);
- },
- /**
- * sets the additional user display name attribute
- *
- * @param {string} attribute
- */
- setUserDisplayName2: function(attribute) {
- this.setElementValue(this.managedItems.ldap_user_display_name_2.$element, attribute);
- },
- /**
- * sets the Base DN for users
- *
- * @param {string} base
- */
- setBaseDNUsers: function(base) {
- this.setElementValue(this.managedItems.ldap_base_users.$element, base);
- },
- /**
- * sets the attributes for user searches
- *
- * @param {string} attributes
- */
- setSearchAttributesUsers: function(attributes) {
- this.setElementValue(this.managedItems.ldap_attributes_for_user_search.$element, attributes);
- },
- /**
- * enables or disables marking remnants as disabled
- *
- * @param {string} markRemnantsAsDisabled contains an int
- */
- setMarkRemnantsAsDisabled: function(markRemnantsAsDisabled) {
- this.setElementValue(this.managedItems.ldap_mark_remnants_as_disabled.$element, markRemnantsAsDisabled);
- },
- /**
- * sets the display name attribute for groups
- *
- * @param {string} attribute
- */
- setGroupDisplayName: function(attribute) {
- this.setElementValue(this.managedItems.ldap_group_display_name.$element, attribute);
- },
- /**
- * sets the Base DN for groups
- *
- * @param {string} base
- */
- setBaseDNGroups: function(base) {
- this.setElementValue(this.managedItems.ldap_base_groups.$element, base);
- },
- /**
- * sets the attributes for group search
- *
- * @param {string} attributes
- */
- setSearchAttributesGroups: function(attributes) {
- this.setElementValue(this.managedItems.ldap_attributes_for_group_search.$element, attributes);
- },
- /**
- * sets the attribute for the association of users and groups
- *
- * @param {string} attribute
- */
- setGroupMemberAssociationAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_group_member_assoc_attribute.$element, attribute);
- },
- /**
- * sets the dynamic group member url attribute
- *
- * @param {string} attribute
- */
- setDynamicGroupMemberURL: function(attribute) {
- this.setElementValue(this.managedItems.ldap_dynamic_group_member_url.$element, attribute);
- },
- /**
- * enabled or disables the use of nested groups (groups in groups in
- * groups…)
- *
- * @param {string} useNestedGroups contains an int
- */
- setUseNestedGroups: function(useNestedGroups) {
- this.setElementValue(this.managedItems.ldap_nested_groups.$element, useNestedGroups);
- },
- /**
- * sets the size of pages for paged search
- *
- * @param {string} size contains an int
- */
- setPagingSize: function(size) {
- this.setElementValue(this.managedItems.ldap_paging_size.$element, size);
- },
- /**
- * sets whether the password changes per user should be enabled
- *
- * @param {string} doPasswordChange contains an int
- */
- setPasswordChangeEnabled: function(doPasswordChange) {
- this.setElementValue(
- this.managedItems.ldap_turn_on_pwd_change.$element, doPasswordChange
- );
- },
- /**
- * sets the default ppolicy attribute
- *
- * @param {string} attribute
- */
- setDefaultPPolicyDN: function(attribute) {
- this.setElementValue(this.managedItems.ldap_default_ppolicy_dn.$element, attribute);
- },
- /**
- * sets the email attribute
- *
- * @param {string} attribute
- */
- setEmailAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_email_attr.$element, attribute);
- },
- /**
- * sets the external storage home attribute
- *
- * @param {string} attribute
- */
- setExternalStorageHomeAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_ext_storage_home_attribute.$element, attribute);
- },
- /**
- * sets the quota attribute
- *
- * @param {string} attribute
- */
- setQuotaAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_quota_attr.$element, attribute);
- },
- /**
- * sets the default quota for LDAP users
- *
- * @param {string} quota contains an int
- */
- setQuotaDefault: function(quota) {
- this.setElementValue(this.managedItems.ldap_quota_def.$element, quota);
- },
- /**
- * sets the attribute for the Nextcloud user specific home folder location
- *
- * @param {string} attribute
- */
- setHomeFolderAttribute: function(attribute) {
- this.setElementValue(this.managedItems.home_folder_naming_rule.$element, attribute);
- },
- /**
- * sets the attribute for the Nextcloud user profile phone Number
- *
- * @param {string} attribute
- */
- setPhoneAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_attr_phone.$element, attribute);
- },
- /**
- * sets the attribute for the Nextcloud user profile website
- *
- * @param {string} attribute
- */
- setWebsiteAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_attr_website.$element, attribute);
- },
- /**
- * sets the attribute for the Nextcloud user profile postal address
- *
- * @param {string} attribute
- */
- setAddressAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_attr_address.$element, attribute);
- },
- /**
- * sets the attribute for the Nextcloud user profile twitter
- *
- * @param {string} attribute
- */
- setTwitterAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_attr_twitter.$element, attribute);
- },
- /**
- * sets the attribute for the Nextcloud user profile fediverse
- *
- * @param {string} attribute
- */
- setFediverseAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_attr_fediverse.$element, attribute);
- },
- /**
- * sets the attribute for the Nextcloud user profile organisation
- *
- * @param {string} attribute
- */
- setOrganisationAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_attr_organisation.$element, attribute);
- },
- /**
- * sets the attribute for the Nextcloud user profile role
- *
- * @param {string} attribute
- */
- setRoleAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_attr_role.$element, attribute);
- },
- /**
- * sets the attribute for the Nextcloud user profile headline
- *
- * @param {string} attribute
- */
- setHeadlineAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_attr_headline.$element, attribute);
- },
- /**
- * sets the attribute for the Nextcloud user profile biography
- *
- * @param {string} attribute
- */
- setBiographyAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_attr_biography.$element, attribute);
- },
- /**
- * sets the attribute for the Nextcloud user profile birthday
- *
- * @param {string} attribute
- */
- setBirthdateAttribute: function(attribute) {
- this.setElementValue(this.managedItems.ldap_attr_birthdate.$element, attribute);
- },
- /**
- * deals with the result of the Test Connection test
- *
- * @param {WizardTabAdvanced} view
- * @param {FeaturePayload} payload
- */
- onResultReceived: function(view, payload) {
- if(payload.feature === 'TestConfiguration') {
- OC.Notification.showTemporary(payload.data.message);
- }
- }
- });
- OCA.LDAP.Wizard.WizardTabAdvanced = WizardTabAdvanced;
- })();
|