Added LDAPSyncWithUserGroups to config.json schema (#4415)

Ylian Saint-Hilaire committed Aug 22, 2022 at 11:57 UTC 334a9b8321973369a5c7feb8847d18d7a7373786
3 files changed +15 -21
meshcentral-config-schema.json
+13
@@ -550,6 +550,19 @@
550 "ldapUserImage": { "type": "string", "default": "thumbnailPhoto", "description": "The LDAP value to use for the user's image." },
551 "ldapSaveUserToFile": { "type": "string", "default": null, "description": "When set to a filename, for example c:\\temp\\ldapusers.txt, MeshCentral will save the LDAP user object to this file each time a user logs in. This is used for debugging LDAP issues." },
552 "ldapUserGroups": { "type": "string", "default": "memberOf", "description": "The LDAP value to use for the user's group memberships." },
553 + "ldapSyncWithUserGroups": {
554 + "type": [ "boolean", "object" ],
555 + "default": false,
556 + "description": "When set to true or set to an object, MeshCentral will syncronized LDAP user memberships to MeshCentral user groups.",
557 + "additionalProperties": false,
558 + "properties": {
559 + "filter": {
560 + "type": [ "string", "array" ],
561 + "default": null,
562 + "description": "When set to a string or array of strings, only LDAP membership groups that includes one of the strings will be syncronized with MeshCentral user groups."
563 + }
564 + }
565 + },
566 "ldapUserRequiredGroupMembership": { "type": [ "string", "array" ], "default": null, "description": "A list of LDAP groups. Users must be part of at least one of these groups to allow login. If null, all users are allowed to login." },
567 "ldapOptions": { "type": "object", "description": "LDAP options passed to ldapauth-fork" },
568 "agentInviteCodes": { "type": "boolean", "default": false, "description": "Enabled a feature where you can set one or more invitation codes in a device group. You can then give a invitation link to users who can use it to download the agent." },
sample-config-advanced.json
+2 -20
@@ -535,26 +535,8 @@
535 "_LDAPUserEmail": "otherMail",
536 "_LDAPUserGroups": "memberOf",
537 "_LDAPUserRequiredGroupMembership": [ "CN=Domain Admins,CN=Users,DC=sample,DC=com" ],
538 - "_LDAPPptions": {
539 - "url": "test",
540 - "anne": {
541 - "gecos": "Anne O'Nyme",
542 - "displayName": "O Nyme anne",
543 - "uid": "anneonyme",
544 - "mail": "anneonyme@example.com",
545 - "email": "anneonyme@example.com",
546 - "otherMail": [ "other.anneonyme@example.com", "anneonyme@example.com" ]
547 - },
548 - "so": {
549 - "displayName": "Sticker Sophie",
550 - "gecos": "Sophie Sticker",
551 - "uid": "ssticker",
552 - "mail": "ssticker@example.com",
553 - "email": "ssticker@example.com",
554 - "otherMail": [ "other.ssticker@example.com", "ssticker@example.com" ]
555 - }
556 - },
557 - "__LDAPOptions": {
538 + "_LDAPSyncWithUserGroups": { "filter": [ "CN=Domain Admins" ] },
539 + "_LDAPOptions": {
540 "URL": "ldap://1.2.3.4:389",
541 "BindDN": "CN=svc_meshcentral,CN=Users,DC=meshcentral,DC=local",
542 "BindCredentials": "Password.1",
webserver.js
-1
@@ -500,7 +500,6 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
500 }
501 if (match) { g.push(userMemberships[i]); }
502 }
503 - console.log(g);
503 userMemberships = g;
504 }
505 } else {