Girish Ramakrishnan
36aa641cb9
migrate to "export default"
...
also, set no-use-before-define in linter
2026-02-14 15:43:24 +01:00
Girish Ramakrishnan
96dc79cfe6
Migrate codebase from CommonJS to ES Modules
...
- Convert all require()/module.exports to import/export across 260+ files
- Add "type": "module" to package.json to enable ESM by default
- Add migrations/package.json with "type": "commonjs" to keep db-migrate compatible
- Convert eslint.config.js to ESM with sourceType: "module"
- Replace __dirname/__filename with import.meta.dirname/import.meta.filename
- Replace require.main === module with process.argv[1] === import.meta.filename
- Remove 'use strict' directives (implicit in ESM)
- Convert dynamic require() in switch statements to static import lookup maps
(dns.js, domains.js, backupformats.js, backupsites.js, network.js)
- Extract self-referencing exports.CONSTANT patterns into standalone const
declarations (apps.js, services.js, locks.js, users.js, mail.js, etc.)
- Lazify SERVICES object in services.js to avoid circular dependency TDZ issues
- Add clearMailQueue() to mailer.js for ESM-safe queue clearing in tests
- Add _setMockApp() to ldapserver.js for ESM-safe test mocking
- Add _setMockResolve() wrapper to dig.js for ESM-safe DNS mocking in tests
- Convert backupupload.js to use dynamic imports so --check exits before
loading the module graph (which requires BOX_ENV)
- Update check-install to use ESM import for infra_version.js
- Convert scripts/ (hotfix, release, remote_hotfix.js, find-unused-translations)
- All 1315 tests passing
Migration stats (AI-assisted using Cursor with Claude):
- Wall clock time: ~3-4 hours
- Assistant completions: ~80-100
- Estimated token usage: ~1-2M tokens
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-02-14 15:11:45 +01:00
Girish Ramakrishnan
bd44bb4534
groups: add app access tests
2025-02-12 14:21:46 +01:00
Girish Ramakrishnan
e4fb040ddf
make tests great again
2024-12-04 16:36:05 +01:00
Girish Ramakrishnan
3b9d617e37
groups: add events to eventlog
2024-12-04 11:30:30 +01:00
Girish Ramakrishnan
fdf8025a02
style: remove -> del
2024-12-03 17:36:50 +01:00
Girish Ramakrishnan
18a680a85b
groups: only the local groups of a user can be set
2024-02-28 15:56:03 +01:00
Girish Ramakrishnan
e26f71b603
externalldap: cannot set members of external group
2024-02-28 15:56:03 +01:00
Girish Ramakrishnan
f98fe43843
test: add ldap group test
2024-02-28 14:25:19 +01:00
Girish Ramakrishnan
8bdcdd7810
groups: members cannot be set for external groups
2024-01-19 23:23:25 +01:00
Girish Ramakrishnan
a1217e52c8
group: cannot set name of ldap group
2024-01-19 22:28:48 +01:00
Girish Ramakrishnan
a8d37b917a
groups: remove unused addMember
2024-01-19 17:25:36 +01:00
Girish Ramakrishnan
74febcd30a
make ldap tests pass
2021-08-13 16:55:39 -07:00
Girish Ramakrishnan
a8760f6c2c
tests: cleanup common variables
2021-08-13 11:34:05 -07:00
Girish Ramakrishnan
ea430b255b
make the tests work
2021-06-29 11:01:46 -07:00
Girish Ramakrishnan
31498afe39
async'ify the groups code
2021-06-29 09:08:45 -07:00
Girish Ramakrishnan
663e0952fc
move wellKnownJson to domains
...
after some more thought:
* If app moves to another location, user has to remember to move all this config
* It's not really associated with an app. It's to do with the domain info
* We can put some hints in the UI if app is missing.
part of #703
2020-12-23 17:13:22 -08:00
Girish Ramakrishnan
246956fd0e
groupMembers: add unique constraint
...
fixes #696
2020-12-22 16:18:15 -08:00
Girish Ramakrishnan
f94ff49fb9
users: replace modifiedAt with ts
2020-07-09 16:02:49 -07:00
Johannes Zellner
42cbcc6ce3
groups.create() now needs source argument
2020-06-04 14:20:05 +02:00
Girish Ramakrishnan
0e156b9376
migrate permissions and admin flag to user.role
2020-02-21 16:49:20 -08:00
Girish Ramakrishnan
c537dfabb2
add manage user permission
2020-02-13 22:49:58 -08:00
Girish Ramakrishnan
a017af41c5
Start moving db code to use BoxError as well
2019-10-24 14:09:53 -07:00
Girish Ramakrishnan
2d115d3d0f
Move GroupsError to BoxError
2019-10-22 16:34:17 -07:00
Girish Ramakrishnan
7d299908c9
Fix tests
2019-08-30 10:49:43 -07:00
Girish Ramakrishnan
8af7dbc35a
group -> list
2019-08-23 16:36:19 -07:00
Girish Ramakrishnan
9b74bb73aa
config.js is dead, long live config.js
...
we use settings now
2019-07-26 14:51:51 -07:00
Girish Ramakrishnan
78a2176d1d
Make admin simply a boolean instead of group
...
This simplifies a lot of logic. Keeping an admin group has no benefit
2018-07-26 22:29:57 -07:00
Girish Ramakrishnan
b4d5def56d
Revert role support
2018-07-26 13:23:06 -07:00
Girish Ramakrishnan
b5c8e7a52a
Rename to getGroups
2018-06-18 14:10:29 -07:00
Girish Ramakrishnan
7f3114e67d
Rename to get/setMembership (to indicate IDs and not group objects
2018-06-18 13:57:17 -07:00
Girish Ramakrishnan
1dbcf2a46a
Rename to groups.update
2018-06-18 13:41:27 -07:00
Girish Ramakrishnan
ca9cd2cf0f
Add groups.getRoles
2018-06-16 00:29:56 -07:00
Girish Ramakrishnan
02d5d2f808
Add API to add and update the group roles
2018-06-15 00:28:27 -07:00
Girish Ramakrishnan
a77d45f5de
Add rolesJson to groups table
...
This will contain the roles ('role definition') of a group of
users. We will internally map these to our API scopes.
2018-06-14 22:54:52 -07:00
Girish Ramakrishnan
5e09f3dcb2
Group names can contain - and end with .app
...
now that we have decoupled it from mailbox names, this restriction
can be removed
2018-06-14 22:22:09 -07:00
Girish Ramakrishnan
6534297a5d
Remove hat module
...
It's not been updated for 6 years!
2018-06-11 12:38:29 -07:00
Girish Ramakrishnan
7bb8d059b5
GroupError -> GroupsError
2018-04-29 11:21:01 -07:00
Johannes Zellner
f028b4a232
Remove mailing list logic from groups tests
2018-01-26 20:07:23 +01:00
Johannes Zellner
cf94f26d62
Fixup the test using fallbackEmail
2018-01-22 11:52:58 +01:00
Girish Ramakrishnan
efe75f0c4e
make tests finish
...
database.uninitialize must be called to drop the connection
2017-11-27 11:57:09 -08:00
Johannes Zellner
1ccc3b84b8
Fixup various tests for multidomain
2017-11-20 20:01:50 +01:00
Girish Ramakrishnan
0a8adaac9f
filter out empty usernames from groups
...
Fixes #472
2017-11-06 11:09:40 -08:00
Girish Ramakrishnan
7efb6d60bc
Allow usernames and groupnames of length 1
...
Fixes #204
2017-02-02 01:02:51 -08:00
Girish Ramakrishnan
536c16929b
Remove showTutorial
2017-01-17 09:11:34 -08:00
Girish Ramakrishnan
cd0243d700
always store the group names as lower case
2016-09-30 12:33:18 -07:00
Girish Ramakrishnan
ba588a1cd7
Fix group name validation to not allow hyphen
...
Fixes #70
2016-09-30 12:28:29 -07:00
Girish Ramakrishnan
475fd06ac0
use unique ids for groups
2016-09-30 09:33:10 -07:00
Girish Ramakrishnan
1d12808b13
test setting group members
2016-09-29 15:15:25 -07:00
Girish Ramakrishnan
a91ae2b9aa
add mailboxdb.getGroup tests
2016-09-27 16:34:28 -07:00