Sync management UI
This commit is contained in:
parent
9b4f8697b9
commit
414c0931eb
|
@ -5,6 +5,9 @@
|
||||||
"LdapConfig": {
|
"LdapConfig": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"Mail": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"MailAlias": {
|
"MailAlias": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -34,8 +37,5 @@
|
||||||
},
|
},
|
||||||
"UserSync": {
|
"UserSync": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
|
||||||
"Mail": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -107,7 +107,7 @@ module.exports = class SyncEngine {
|
||||||
try {
|
try {
|
||||||
await connector.sync(info, userName, password);
|
await connector.sync(info, userName, password);
|
||||||
if (syncGroups)
|
if (syncGroups)
|
||||||
await connector.syncGroups(user, userName);
|
await connector.syncGroups(info, userName);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
errs.push(err);
|
errs.push(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ class SyncLdap extends SyncConnector {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasAccount) {
|
if (!hasAccount) {
|
||||||
|
if (oldUser)
|
||||||
console.log(` -> '${userName}' removed from LDAP`);
|
console.log(` -> '${userName}' removed from LDAP`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -164,8 +165,9 @@ class SyncLdap extends SyncConnector {
|
||||||
}
|
}
|
||||||
await Promise.all(reqs);
|
await Promise.all(reqs);
|
||||||
|
|
||||||
if (hasAccount) {
|
if (!hasAccount) return;
|
||||||
let reqs = [];
|
|
||||||
|
reqs = [];
|
||||||
for (let role of user.roles()) {
|
for (let role of user.roles()) {
|
||||||
let change = new ldap.Change({
|
let change = new ldap.Change({
|
||||||
operation: 'add',
|
operation: 'add',
|
||||||
|
@ -177,7 +179,6 @@ class SyncLdap extends SyncConnector {
|
||||||
}
|
}
|
||||||
await Promise.all(reqs);
|
await Promise.all(reqs);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
async getUsers(usersToSync) {
|
async getUsers(usersToSync) {
|
||||||
let {
|
let {
|
||||||
|
|
|
@ -15,3 +15,6 @@ import './basic-data';
|
||||||
import './mail-forwarding';
|
import './mail-forwarding';
|
||||||
import './aliases';
|
import './aliases';
|
||||||
import './roles';
|
import './roles';
|
||||||
|
import './ldap';
|
||||||
|
import './samba';
|
||||||
|
import './posix';
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
<vn-watcher
|
||||||
|
vn-id="watcher"
|
||||||
|
url="LdapConfigs"
|
||||||
|
data="$ctrl.config"
|
||||||
|
id-value="1"
|
||||||
|
form="form">
|
||||||
|
</vn-watcher>
|
||||||
|
<form
|
||||||
|
name="form"
|
||||||
|
ng-submit="watcher.submit()"
|
||||||
|
class="vn-w-md">
|
||||||
|
<vn-card class="vn-pa-lg">
|
||||||
|
<vn-vertical>
|
||||||
|
<vn-textfield
|
||||||
|
label="Host"
|
||||||
|
ng-model="$ctrl.config.host"
|
||||||
|
rule="LdapConfig"
|
||||||
|
vn-focus>
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
label="RDN"
|
||||||
|
ng-model="$ctrl.config.rdn"
|
||||||
|
rule="LdapConfig">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
label="Password"
|
||||||
|
ng-model="$ctrl.config.password"
|
||||||
|
info="Password should be base64 encoded"
|
||||||
|
type="password"
|
||||||
|
rule="LdapConfig">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
label="Base DN"
|
||||||
|
ng-model="$ctrl.config.baseDn"
|
||||||
|
rule="LdapConfig">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
label="Filter"
|
||||||
|
ng-model="$ctrl.config.filter"
|
||||||
|
rule="LdapConfig">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
label="Group DN"
|
||||||
|
ng-model="$ctrl.config.groupDn"
|
||||||
|
rule="LdapConfig">
|
||||||
|
</vn-textfield>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
||||||
|
<vn-button-bar>
|
||||||
|
<vn-button
|
||||||
|
label="Undo changes"
|
||||||
|
ng-if="watcher.dataChanged()"
|
||||||
|
ng-click="watcher.loadOriginalData()">
|
||||||
|
</vn-button>
|
||||||
|
<vn-button
|
||||||
|
label="Synchronize now"
|
||||||
|
ng-if="watcher.hasData"
|
||||||
|
ng-click="$ctrl.onSynchronizeAll()">
|
||||||
|
</vn-button>
|
||||||
|
<vn-button
|
||||||
|
label="Synchronize user"
|
||||||
|
ng-if="watcher.hasData"
|
||||||
|
ng-click="syncUser.show()">
|
||||||
|
</vn-button>
|
||||||
|
</vn-button-bar>
|
||||||
|
<vn-submit
|
||||||
|
icon="save"
|
||||||
|
vn-tooltip="Save"
|
||||||
|
class="round"
|
||||||
|
fixed-bottom-right>
|
||||||
|
</vn-submit>
|
||||||
|
</form>
|
||||||
|
<vn-dialog
|
||||||
|
vn-id="syncUser"
|
||||||
|
on-accept="$ctrl.onUserSync()"
|
||||||
|
on-close="$ctrl.onPassClose()">
|
||||||
|
<tpl-body>
|
||||||
|
<vn-textfield
|
||||||
|
label="Username"
|
||||||
|
ng-model="$ctrl.syncUser">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
label="Password"
|
||||||
|
ng-model="$ctrl.syncPassword"
|
||||||
|
type="password"
|
||||||
|
info="If password is not specified, just user attributes are synchronized">
|
||||||
|
</vn-textfield>
|
||||||
|
</tpl-body>
|
||||||
|
<tpl-buttons>
|
||||||
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
|
<button response="accept" translate>Synchronize</button>
|
||||||
|
</tpl-buttons>
|
||||||
|
</vn-dialog>
|
|
@ -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
|
||||||
|
});
|
|
@ -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
|
|
@ -0,0 +1,69 @@
|
||||||
|
<vn-watcher
|
||||||
|
vn-id="watcher"
|
||||||
|
url="AccountConfigs"
|
||||||
|
data="$ctrl.config"
|
||||||
|
id-value="1"
|
||||||
|
form="form">
|
||||||
|
</vn-watcher>
|
||||||
|
<form
|
||||||
|
name="form"
|
||||||
|
ng-submit="watcher.submit()"
|
||||||
|
class="vn-w-md">
|
||||||
|
<vn-card class="vn-pa-lg">
|
||||||
|
<vn-vertical>
|
||||||
|
<vn-textfield
|
||||||
|
label="Homedir"
|
||||||
|
ng-model="$ctrl.config.homedir"
|
||||||
|
rule="AccountConfig"
|
||||||
|
vn-focus>
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
label="Shell"
|
||||||
|
ng-model="$ctrl.config.shell"
|
||||||
|
rule="AccountConfig">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-input-number
|
||||||
|
label="Id base"
|
||||||
|
ng-model="$ctrl.config.idBase"
|
||||||
|
rule="AccountConfig">
|
||||||
|
</vn-input-number>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-input-number
|
||||||
|
label="Min"
|
||||||
|
ng-model="$ctrl.config.min"
|
||||||
|
rule="AccountConfig">
|
||||||
|
</vn-input-number>
|
||||||
|
<vn-input-number
|
||||||
|
label="Max"
|
||||||
|
ng-model="$ctrl.config.max"
|
||||||
|
rule="AccountConfig">
|
||||||
|
</vn-input-number>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-input-number
|
||||||
|
label="Warn"
|
||||||
|
ng-model="$ctrl.config.warn"
|
||||||
|
rule="AccountConfig">
|
||||||
|
</vn-input-number>
|
||||||
|
<vn-input-number
|
||||||
|
label="Inact"
|
||||||
|
ng-model="$ctrl.config.inact"
|
||||||
|
rule="AccountConfig">
|
||||||
|
</vn-input-number>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
||||||
|
<vn-button-bar>
|
||||||
|
<vn-button
|
||||||
|
label="Undo changes"
|
||||||
|
ng-if="watcher.dataChanged()"
|
||||||
|
ng-click="watcher.loadOriginalData()">
|
||||||
|
</vn-button>
|
||||||
|
</vn-button-bar>
|
||||||
|
<vn-submit
|
||||||
|
icon="save"
|
||||||
|
vn-tooltip="Save"
|
||||||
|
class="round"
|
||||||
|
fixed-bottom-right>
|
||||||
|
</vn-submit>
|
||||||
|
</form>
|
|
@ -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
|
||||||
|
});
|
|
@ -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
|
|
@ -9,6 +9,9 @@
|
||||||
{"state": "account.index", "icon": "face"},
|
{"state": "account.index", "icon": "face"},
|
||||||
{"state": "account.role", "icon": "group"},
|
{"state": "account.role", "icon": "group"},
|
||||||
{"state": "account.alias", "icon": "email"},
|
{"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.acl", "icon": "check"},
|
||||||
{"state": "account.connections", "icon": "share"}
|
{"state": "account.connections", "icon": "share"}
|
||||||
],
|
],
|
||||||
|
@ -174,6 +177,24 @@
|
||||||
"state": "account.alias.card.users",
|
"state": "account.alias.card.users",
|
||||||
"component": "vn-alias-users",
|
"component": "vn-alias-users",
|
||||||
"description": "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",
|
"url": "/acl?q",
|
||||||
"state": "account.acl",
|
"state": "account.acl",
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
<vn-watcher
|
||||||
|
vn-id="watcher"
|
||||||
|
url="SambaConfigs"
|
||||||
|
data="$ctrl.config"
|
||||||
|
id-value="1"
|
||||||
|
form="form">
|
||||||
|
</vn-watcher>
|
||||||
|
<form
|
||||||
|
name="form"
|
||||||
|
ng-submit="watcher.submit()"
|
||||||
|
class="vn-w-md">
|
||||||
|
<vn-card class="vn-pa-lg">
|
||||||
|
<vn-vertical>
|
||||||
|
<vn-textfield
|
||||||
|
label="SSH host"
|
||||||
|
ng-model="$ctrl.config.host"
|
||||||
|
rule="SambaConfig"
|
||||||
|
vn-focus>
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
label="User"
|
||||||
|
ng-model="$ctrl.config.sshUser"
|
||||||
|
rule="SambaConfig">
|
||||||
|
</vn-textfield>
|
||||||
|
<vn-textfield
|
||||||
|
label="Password"
|
||||||
|
ng-model="$ctrl.config.sshPass"
|
||||||
|
info="Password should be base64 encoded"
|
||||||
|
type="password"
|
||||||
|
rule="SambaConfig">
|
||||||
|
</vn-textfield>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
||||||
|
<vn-button-bar>
|
||||||
|
<vn-button
|
||||||
|
label="Undo changes"
|
||||||
|
ng-if="watcher.dataChanged()"
|
||||||
|
ng-click="watcher.loadOriginalData()">
|
||||||
|
</vn-button>
|
||||||
|
</vn-button-bar>
|
||||||
|
<vn-submit
|
||||||
|
icon="save"
|
||||||
|
vn-tooltip="Save"
|
||||||
|
class="round"
|
||||||
|
fixed-bottom-right>
|
||||||
|
</vn-submit>
|
||||||
|
</form>
|
|
@ -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
|
||||||
|
});
|
|
@ -0,0 +1,2 @@
|
||||||
|
SSH host: Host SSH
|
||||||
|
Password should be base64 encoded: La contraseña debe estar codificada en base64
|
Loading…
Reference in New Issue