diff --git a/modules/account/back/model-config.json b/modules/account/back/model-config.json index 6e3d96025..a613b382c 100644 --- a/modules/account/back/model-config.json +++ b/modules/account/back/model-config.json @@ -5,6 +5,9 @@ "LdapConfig": { "dataSource": "vn" }, + "Mail": { + "dataSource": "vn" + }, "MailAlias": { "dataSource": "vn" }, @@ -34,8 +37,5 @@ }, "UserSync": { "dataSource": "vn" - }, - "Mail": { - "dataSource": "vn" } } \ No newline at end of file diff --git a/modules/account/back/util/sync-engine.js b/modules/account/back/util/sync-engine.js index ff82d84f2..5ca9cac65 100644 --- a/modules/account/back/util/sync-engine.js +++ b/modules/account/back/util/sync-engine.js @@ -107,7 +107,7 @@ module.exports = class SyncEngine { try { await connector.sync(info, userName, password); if (syncGroups) - await connector.syncGroups(user, userName); + await connector.syncGroups(info, userName); } catch (err) { errs.push(err); } diff --git a/modules/account/back/util/sync-ldap.js b/modules/account/back/util/sync-ldap.js index 4f73d04db..d72520ed6 100644 --- a/modules/account/back/util/sync-ldap.js +++ b/modules/account/back/util/sync-ldap.js @@ -66,7 +66,8 @@ class SyncLdap extends SyncConnector { } if (!hasAccount) { - console.log(` -> '${userName}' removed from LDAP`); + if (oldUser) + console.log(` -> '${userName}' removed from LDAP`); return; } @@ -164,19 +165,19 @@ class SyncLdap extends SyncConnector { } await Promise.all(reqs); - if (hasAccount) { - let reqs = []; - for (let role of user.roles()) { - let change = new ldap.Change({ - operation: 'add', - modification: {memberUid: userName} - }); - let roleName = role.inherits().name; - let dn = `cn=${roleName},${ldapConfig.groupDn}`; - reqs.push(client.modify(dn, change)); - } - await Promise.all(reqs); + if (!hasAccount) return; + + reqs = []; + for (let role of user.roles()) { + let change = new ldap.Change({ + operation: 'add', + modification: {memberUid: userName} + }); + let roleName = role.inherits().name; + let dn = `cn=${roleName},${ldapConfig.groupDn}`; + reqs.push(client.modify(dn, change)); } + await Promise.all(reqs); } async getUsers(usersToSync) { diff --git a/modules/account/front/index.js b/modules/account/front/index.js index 359fdff72..7a826f270 100644 --- a/modules/account/front/index.js +++ b/modules/account/front/index.js @@ -15,3 +15,6 @@ import './basic-data'; import './mail-forwarding'; import './aliases'; import './roles'; +import './ldap'; +import './samba'; +import './posix'; diff --git a/modules/account/front/ldap/index.html b/modules/account/front/ldap/index.html new file mode 100644 index 000000000..5c9ec7625 --- /dev/null +++ b/modules/account/front/ldap/index.html @@ -0,0 +1,93 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + diff --git a/modules/account/front/ldap/index.js b/modules/account/front/ldap/index.js new file mode 100644 index 000000000..f68071a1c --- /dev/null +++ b/modules/account/front/ldap/index.js @@ -0,0 +1,30 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; +import UserError from 'core/lib/user-error'; + +export default class Controller extends Section { + onSynchronizeAll() { + this.vnApp.showSuccess(this.$t('Synchronizing in the background')); + this.$http.patch(`UserAccounts/syncAll`) + .then(() => this.vnApp.showSuccess(this.$t('LDAP users synchronized'))); + } + + onUserSync() { + if (!this.syncUser) + throw new UserError('Please enter the username'); + + let params = {password: this.syncPassword}; + return this.$http.patch(`UserAccounts/${this.syncUser}/sync`, params) + .then(() => this.vnApp.showSuccess(this.$t('User synchronized'))); + } + + onSyncClose() { + this.syncUser = ''; + this.syncPassword = ''; + } +} + +ngModule.component('vnAccountLdap', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/account/front/ldap/locale/es.yml b/modules/account/front/ldap/locale/es.yml new file mode 100644 index 000000000..e7481699f --- /dev/null +++ b/modules/account/front/ldap/locale/es.yml @@ -0,0 +1,16 @@ +Host: Host +RDN: RDN +Base DN: DN base +Password should be base64 encoded: La contraseña debe estar codificada en base64 +Filter: Filtro +Group DN: DN grupos +Synchronize now: Sincronizar ahora +Synchronize user: Sincronizar usuario +If password is not specified, just user attributes are synchronized: >- + Si la contraseña no se especifica solo se sincronizarán lo atributos del usuario +Synchronizing in the background: Sincronizando en segundo plano +LDAP users synchronized: Usuarios LDAP sincronizados +Username: Nombre de usuario +Synchronize: Sincronizar +Please enter the username: Por favor introduce el nombre de usuario +User synchronized: Usuario sincronizado diff --git a/modules/account/front/posix/index.html b/modules/account/front/posix/index.html new file mode 100644 index 000000000..40f212bdc --- /dev/null +++ b/modules/account/front/posix/index.html @@ -0,0 +1,69 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/modules/account/front/posix/index.js b/modules/account/front/posix/index.js new file mode 100644 index 000000000..2b86703ac --- /dev/null +++ b/modules/account/front/posix/index.js @@ -0,0 +1,9 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section {} + +ngModule.component('vnAccountPosix', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/account/front/posix/locale/es.yml b/modules/account/front/posix/locale/es.yml new file mode 100644 index 000000000..e7481699f --- /dev/null +++ b/modules/account/front/posix/locale/es.yml @@ -0,0 +1,16 @@ +Host: Host +RDN: RDN +Base DN: DN base +Password should be base64 encoded: La contraseña debe estar codificada en base64 +Filter: Filtro +Group DN: DN grupos +Synchronize now: Sincronizar ahora +Synchronize user: Sincronizar usuario +If password is not specified, just user attributes are synchronized: >- + Si la contraseña no se especifica solo se sincronizarán lo atributos del usuario +Synchronizing in the background: Sincronizando en segundo plano +LDAP users synchronized: Usuarios LDAP sincronizados +Username: Nombre de usuario +Synchronize: Sincronizar +Please enter the username: Por favor introduce el nombre de usuario +User synchronized: Usuario sincronizado diff --git a/modules/account/front/routes.json b/modules/account/front/routes.json index 36caf8644..6382b4f4e 100644 --- a/modules/account/front/routes.json +++ b/modules/account/front/routes.json @@ -9,6 +9,9 @@ {"state": "account.index", "icon": "face"}, {"state": "account.role", "icon": "group"}, {"state": "account.alias", "icon": "email"}, + {"state": "account.posix", "icon": "accessibility"}, + {"state": "account.ldap", "icon": "account_tree"}, + {"state": "account.samba", "icon": "desktop_windows"}, {"state": "account.acl", "icon": "check"}, {"state": "account.connections", "icon": "share"} ], @@ -174,6 +177,24 @@ "state": "account.alias.card.users", "component": "vn-alias-users", "description": "Users" + }, { + "url": "/posix", + "state": "account.posix", + "component": "vn-account-posix", + "description": "Posix", + "acl": ["developer"] + }, { + "url": "/ldap", + "state": "account.ldap", + "component": "vn-account-ldap", + "description": "LDAP", + "acl": ["developer"] + }, { + "url": "/samba", + "state": "account.samba", + "component": "vn-account-samba", + "description": "Samba", + "acl": ["developer"] }, { "url": "/acl?q", "state": "account.acl", diff --git a/modules/account/front/samba/index.html b/modules/account/front/samba/index.html new file mode 100644 index 000000000..57461cb14 --- /dev/null +++ b/modules/account/front/samba/index.html @@ -0,0 +1,47 @@ + + +
+ + + + + + + + + + + + + + + + +
diff --git a/modules/account/front/samba/index.js b/modules/account/front/samba/index.js new file mode 100644 index 000000000..923bdc0be --- /dev/null +++ b/modules/account/front/samba/index.js @@ -0,0 +1,9 @@ +import ngModule from '../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section {} + +ngModule.component('vnAccountSamba', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/account/front/samba/locale/es.yml b/modules/account/front/samba/locale/es.yml new file mode 100644 index 000000000..7cfc4c744 --- /dev/null +++ b/modules/account/front/samba/locale/es.yml @@ -0,0 +1,2 @@ +SSH host: Host SSH +Password should be base64 encoded: La contraseña debe estar codificada en base64