-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ldif script to work with latest version of node. Add a usersPerGr…
…oup variable so we don't add every user to every group.
- Loading branch information
Showing
2 changed files
with
9 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,18 +8,21 @@ const fs = require('node:fs'); | |
const userCount = 1000; | ||
const groupCount = 50; | ||
const maxFileSize = 2000000; // php ldap admin has a 2MB limit | ||
const usersPerGroup = 100; | ||
|
||
let fileSize = 0; | ||
let fileCount = 0; | ||
const baseFileName = "big-"; | ||
|
||
let f; | ||
let f = null; | ||
// Only pass strings that constitute full objects to write(). | ||
// Otherwise the object will span across multiple files and import will fail. | ||
function write (data, opts = {}) { | ||
fileSize += data.length; | ||
if (fileSize > maxFileSize) { | ||
fs.closeSync(f); | ||
if (f) { | ||
fs.closeSync(f); | ||
} | ||
fileSize = data.length; | ||
fileCount++; | ||
f = null; | ||
|
@@ -56,7 +59,7 @@ cn: testgroup${groupIdStr} | |
gidNumber: ${groupId} | ||
`; | ||
|
||
for (let userId = 0; userId < userCount; userId++) { | ||
for (let userId = 0; userId < usersPerGroup; userId++) { | ||
const userIdStr = ("00000" + userId).slice(-5); | ||
groupStr += `memberUid: testuser${userIdStr}@example.com | ||
`; | ||
|
@@ -75,7 +78,7 @@ cn: othertestgroup${groupIdStr} | |
owner: [email protected],dc=example,dc=org | ||
`; | ||
|
||
for (let userId = 0; userId < userCount; userId++) { | ||
for (let userId = 0; userId < usersPerGroup; userId++) { | ||
const userIdStr = ("00000" + userId).slice(-5); | ||
groupStr += `uniquemember: cn=testuser${userIdStr}@example.com,dc=example,dc=org | ||
`; | ||
|