auth settings changes
This commit is contained in:
@@ -5,28 +5,5 @@
|
||||
[{"name": "authenticationMethod"}, {"name": "authTokenLifetime"}],
|
||||
[{"name": "authTokenPreventConcurrent"}, {"name": "authTokenMaxIdleTime"}]
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "LDAP",
|
||||
"name": "LDAP",
|
||||
"rows": [
|
||||
[{"name": "ldapHost"}, {"name": "ldapPort"}],
|
||||
[{"name": "ldapAuth"}, {"name": "ldapSecurity"}],
|
||||
[{"name": "ldapUsername", "fullWidth": true}],
|
||||
[{"name": "ldapPassword"}, {"name": "testConnection", "customLabel": null, "view": "views/admin/authentication/fields/test-connection"}],
|
||||
[{"name": "ldapUserNameAttribute"}, {"name": "ldapUserObjectClass"}],
|
||||
[{"name": "ldapAccountCanonicalForm"}, {"name": "ldapBindRequiresDn"}],
|
||||
[{"name": "ldapBaseDn", "fullWidth": true}],
|
||||
[{"name": "ldapUserLoginFilter", "fullWidth": true}],
|
||||
[{"name": "ldapAccountDomainName"}, {"name": "ldapAccountDomainNameShort"}],
|
||||
[{"name": "ldapTryUsernameSplit"}, {"name": "ldapOptReferrals"}],
|
||||
[{"name": "ldapCreateEspoUser"}, false],
|
||||
[{"name": "ldapUserFirstNameAttribute"}, {"name": "ldapUserLastNameAttribute"}],
|
||||
[{"name": "ldapUserTitleAttribute"}, false],
|
||||
[{"name": "ldapUserEmailAddressAttribute"}, {"name": "ldapUserPhoneNumberAttribute"}],
|
||||
[{"name": "ldapUserTeams"}, {"name": "ldapUserDefaultTeam"}],
|
||||
[{"name": "ldapPortalUserLdapAuth"}, false],
|
||||
[{"name": "ldapPortalUserPortals"}, {"name": "ldapPortalUserRoles"}]
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
{
|
||||
|
||||
"settings": {
|
||||
"layout": {
|
||||
"label": "LDAP",
|
||||
"rows": [
|
||||
[{"name": "ldapHost"}, {"name": "ldapPort"}],
|
||||
[{"name": "ldapAuth"}, {"name": "ldapSecurity"}],
|
||||
[{"name": "ldapUsername", "fullWidth": true}],
|
||||
[{"name": "ldapPassword"}, {"name": "testConnection", "customLabel": null, "view": "views/admin/authentication/fields/test-connection"}],
|
||||
[{"name": "ldapUserNameAttribute"}, {"name": "ldapUserObjectClass"}],
|
||||
[{"name": "ldapAccountCanonicalForm"}, {"name": "ldapBindRequiresDn"}],
|
||||
[{"name": "ldapBaseDn", "fullWidth": true}],
|
||||
[{"name": "ldapUserLoginFilter", "fullWidth": true}],
|
||||
[{"name": "ldapAccountDomainName"}, {"name": "ldapAccountDomainNameShort"}],
|
||||
[{"name": "ldapTryUsernameSplit"}, {"name": "ldapOptReferrals"}],
|
||||
[{"name": "ldapCreateEspoUser"}, false],
|
||||
[{"name": "ldapUserFirstNameAttribute"}, {"name": "ldapUserLastNameAttribute"}],
|
||||
[{"name": "ldapUserTitleAttribute"}, false],
|
||||
[{"name": "ldapUserEmailAddressAttribute"}, {"name": "ldapUserPhoneNumberAttribute"}],
|
||||
[{"name": "ldapUserTeams"}, {"name": "ldapUserDefaultTeam"}],
|
||||
[{"name": "ldapPortalUserLdapAuth"}, false],
|
||||
[{"name": "ldapPortalUserPortals"}, {"name": "ldapPortalUserRoles"}]
|
||||
]
|
||||
},
|
||||
"fieldList": [
|
||||
"ldapHost", "ldapPort", "ldapAuth", "ldapSecurity",
|
||||
"ldapUsername", "ldapPassword", "ldapBindRequiresDn",
|
||||
"ldapUserLoginFilter", "ldapBaseDn", "ldapAccountCanonicalForm",
|
||||
"ldapAccountDomainName", "ldapAccountDomainNameShort", "ldapAccountDomainName",
|
||||
"ldapAccountDomainNameShort", "ldapTryUsernameSplit", "ldapOptReferrals",
|
||||
"ldapCreateEspoUser", "ldapPortalUserLdapAuth"
|
||||
],
|
||||
"dynamicLogic": {
|
||||
"fields": {
|
||||
"ldapUsername": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "isTrue",
|
||||
"attribute": "ldapAuth"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ldapPassword": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "isTrue",
|
||||
"attribute": "ldapAuth"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"testConnection": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "isTrue",
|
||||
"attribute": "ldapAuth"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ldapAccountDomainName": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "in",
|
||||
"attribute": "ldapAccountCanonicalForm",
|
||||
"value": ["Backslash", "Principal"]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ldapAccountDomainNameShort": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "in",
|
||||
"attribute": "ldapAccountCanonicalForm",
|
||||
"value": ["Backslash", "Principal"]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ldapUserTitleAttribute": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "isTrue",
|
||||
"attribute": "ldapCreateEspoUser"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ldapUserFirstNameAttribute": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "isTrue",
|
||||
"attribute": "ldapCreateEspoUser"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ldapUserLastNameAttribute": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "isTrue",
|
||||
"attribute": "ldapCreateEspoUser"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ldapUserEmailAddressAttribute": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "isTrue",
|
||||
"attribute": "ldapCreateEspoUser"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ldapUserPhoneNumberAttribute": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "isTrue",
|
||||
"attribute": "ldapCreateEspoUser"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ldapUserTeams": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "isTrue",
|
||||
"attribute": "ldapCreateEspoUser"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ldapUserDefaultTeam": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "isTrue",
|
||||
"attribute": "ldapCreateEspoUser"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ldapPortalUserPortals": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "isTrue",
|
||||
"attribute": "ldapPortalUserLdapAuth"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ldapPortalUserRoles": {
|
||||
"visible": {
|
||||
"conditionGroup": [
|
||||
{
|
||||
"type": "isTrue",
|
||||
"attribute": "ldapPortalUserLdapAuth"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,136 +26,81 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/admin/authentication', 'views/settings/record/edit', function (Dep) {
|
||||
define('views/admin/authentication', 'views/settings/record/edit', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
layoutName: 'authentication',
|
||||
|
||||
dependencyDefs: {
|
||||
'ldapAuth': {
|
||||
map: {
|
||||
true: [
|
||||
{
|
||||
action: 'show',
|
||||
fields: ['ldapUsername', 'ldapPassword', 'testConnection']
|
||||
}
|
||||
]
|
||||
},
|
||||
default: [
|
||||
{
|
||||
action: 'hide',
|
||||
fields: ['ldapUsername', 'ldapPassword', 'testConnection']
|
||||
}
|
||||
]
|
||||
},
|
||||
'ldapAccountCanonicalForm': {
|
||||
map: {
|
||||
'Backslash': [
|
||||
{
|
||||
action: 'show',
|
||||
fields: ['ldapAccountDomainName', 'ldapAccountDomainNameShort']
|
||||
}
|
||||
],
|
||||
'Principal': [
|
||||
{
|
||||
action: 'show',
|
||||
fields: ['ldapAccountDomainName', 'ldapAccountDomainNameShort']
|
||||
}
|
||||
]
|
||||
},
|
||||
default: [
|
||||
{
|
||||
action: 'hide',
|
||||
fields: ['ldapAccountDomainName', 'ldapAccountDomainNameShort']
|
||||
}
|
||||
]
|
||||
},
|
||||
'ldapCreateEspoUser': {
|
||||
map: {
|
||||
true: [
|
||||
{
|
||||
action: 'show',
|
||||
fields: ['ldapUserTitleAttribute', 'ldapUserFirstNameAttribute', 'ldapUserLastNameAttribute', 'ldapUserEmailAddressAttribute', 'ldapUserPhoneNumberAttribute', 'ldapUserTeams', 'ldapUserDefaultTeam']
|
||||
}
|
||||
]
|
||||
},
|
||||
default: [
|
||||
{
|
||||
action: 'hide',
|
||||
fields: ['ldapUserTitleAttribute', 'ldapUserFirstNameAttribute', 'ldapUserLastNameAttribute', 'ldapUserEmailAddressAttribute', 'ldapUserPhoneNumberAttribute', 'ldapUserTeams', 'ldapUserDefaultTeam']
|
||||
}
|
||||
]
|
||||
},
|
||||
'ldapPortalUserLdapAuth': {
|
||||
map: {
|
||||
true: [
|
||||
{
|
||||
action: 'show',
|
||||
fields: ['ldapPortalUserPortals', 'ldapPortalUserRoles']
|
||||
}
|
||||
]
|
||||
},
|
||||
default: [
|
||||
{
|
||||
action: 'hide',
|
||||
fields: ['ldapPortalUserPortals', 'ldapPortalUserRoles']
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
this.methodList = this.getMetadata().get('entityDefs.Settings.fields.authenticationMethod.options') || [];
|
||||
|
||||
this.authFields = {
|
||||
'LDAP': [
|
||||
'ldapHost', 'ldapPort', 'ldapAuth', 'ldapSecurity',
|
||||
'ldapUsername', 'ldapPassword', 'ldapBindRequiresDn',
|
||||
'ldapUserLoginFilter', 'ldapBaseDn', 'ldapAccountCanonicalForm',
|
||||
'ldapAccountDomainName', 'ldapAccountDomainNameShort', 'ldapAccountDomainName',
|
||||
'ldapAccountDomainNameShort', 'ldapTryUsernameSplit', 'ldapOptReferrals',
|
||||
'ldapCreateEspoUser', 'ldapPortalUserLdapAuth'
|
||||
]
|
||||
};
|
||||
this.authFields = {};
|
||||
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
this.handlePanelsVisibility();
|
||||
},
|
||||
|
||||
|
||||
afterRender: function () {
|
||||
this.listenTo(this.model, 'change:authenticationMethod', function () {
|
||||
this.handlePanelsVisibility();
|
||||
}, this);
|
||||
},
|
||||
|
||||
setupBeforeFinal: function () {
|
||||
this.dynamicLogicDefs = {
|
||||
fields: {},
|
||||
panels: {},
|
||||
};
|
||||
|
||||
this.methodList.forEach(function (method) {
|
||||
var fieldList = this.getMetadata().get(['authenticationMethods', method, 'settings', 'fieldList']);
|
||||
if (fieldList) {
|
||||
this.authFields[method] = fieldList;
|
||||
}
|
||||
var mDynamicLogicFieldsDefs = this.getMetadata().get(['authenticationMethods', method, 'settings', 'dynamicLogic', 'fields']);
|
||||
if (mDynamicLogicFieldsDefs) {
|
||||
for (var f in mDynamicLogicFieldsDefs) {
|
||||
this.dynamicLogicDefs.fields[f] = Espo.Utils.cloneDeep(mDynamicLogicFieldsDefs[f]);
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
Dep.prototype.setupBeforeFinal.call(this);
|
||||
},
|
||||
|
||||
modifyDetailLayout: function (layout) {
|
||||
this.methodList.forEach(function (method) {
|
||||
var mLayout = this.getMetadata().get(['authenticationMethods', method, 'settings', 'layout']);
|
||||
if (mLayout) {
|
||||
mLayout = Espo.Utils.cloneDeep(mLayout);
|
||||
mLayout.name = method;
|
||||
layout.push(mLayout);
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
handlePanelsVisibility: function () {
|
||||
var authenticationMethod = this.model.get('authenticationMethod');
|
||||
|
||||
this.methodList.forEach(function (method) {
|
||||
var list = (this.authFields[method] || []);
|
||||
var fieldList = (this.authFields[method] || []);
|
||||
|
||||
if (method != authenticationMethod) {
|
||||
this.hidePanel(method);
|
||||
list.forEach(function (field) {
|
||||
|
||||
fieldList.forEach(function (field) {
|
||||
this.hideField(field);
|
||||
}, this);
|
||||
} else {
|
||||
this.showPanel(method);
|
||||
|
||||
list.forEach(function (field) {
|
||||
fieldList.forEach(function (field) {
|
||||
this.showField(field);
|
||||
}, this);
|
||||
Object.keys(this.dependencyDefs || {}).forEach(function (attr) {
|
||||
if (~list.indexOf(attr)) {
|
||||
this._handleDependencyAttribute(attr);
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.processDynamicLogic();
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1369,6 +1369,10 @@ define('views/record/detail', ['views/record/base', 'view-record-helper'], funct
|
||||
}
|
||||
|
||||
this._helper.layoutManager.get(this.model.name, this.layoutName, function (simpleLayout) {
|
||||
if (typeof this.modifyDetailLayout == 'function') {
|
||||
var simpleLayout = Espo.Utils.cloneDeep(simpleLayout);
|
||||
this.modifyDetailLayout(simpleLayout);
|
||||
}
|
||||
this.gridLayout = {
|
||||
type: gridLayoutType,
|
||||
layout: this.convertDetailLayout(simpleLayout)
|
||||
|
||||
Reference in New Issue
Block a user