2023-01-15 01:11:16 +01:00
|
|
|
import { ReactiveCache } from '/imports/reactiveCache';
|
|
|
|
|
|
2019-07-15 19:39:30 +03:00
|
|
|
Org = new Mongo.Collection('org');
|
|
|
|
|
|
|
|
|
|
/**
|
2020-12-28 21:08:27 +02:00
|
|
|
* A Organization in Wekan. A Enterprise in Trello.
|
2019-07-15 19:39:30 +03:00
|
|
|
*/
|
|
|
|
|
Org.attachSchema(
|
|
|
|
|
new SimpleSchema({
|
2021-02-11 19:07:34 +02:00
|
|
|
orgDisplayName: {
|
2019-07-15 19:39:30 +03:00
|
|
|
/**
|
2020-12-28 21:08:27 +02:00
|
|
|
* the name to display for the organization
|
2019-07-15 19:39:30 +03:00
|
|
|
*/
|
2020-12-28 21:08:27 +02:00
|
|
|
type: String,
|
2019-07-15 19:39:30 +03:00
|
|
|
optional: true,
|
|
|
|
|
},
|
2021-02-11 19:07:34 +02:00
|
|
|
orgDesc: {
|
2019-07-15 19:39:30 +03:00
|
|
|
/**
|
2020-12-28 21:08:27 +02:00
|
|
|
* the description the organization
|
2019-07-15 19:39:30 +03:00
|
|
|
*/
|
|
|
|
|
type: String,
|
|
|
|
|
optional: true,
|
|
|
|
|
max: 190,
|
|
|
|
|
},
|
2021-02-11 19:07:34 +02:00
|
|
|
orgShortName: {
|
2019-07-15 19:39:30 +03:00
|
|
|
/**
|
2020-12-28 21:08:27 +02:00
|
|
|
* short name of the organization
|
2019-07-15 19:39:30 +03:00
|
|
|
*/
|
|
|
|
|
type: String,
|
|
|
|
|
optional: true,
|
|
|
|
|
max: 255,
|
|
|
|
|
},
|
2023-11-19 23:33:40 +02:00
|
|
|
orgAutoAddUsersWithDomainName: {
|
|
|
|
|
/**
|
|
|
|
|
* automatically add users with domain name
|
|
|
|
|
*/
|
|
|
|
|
type: String,
|
|
|
|
|
optional: true,
|
|
|
|
|
max: 255,
|
|
|
|
|
},
|
2021-02-11 19:07:34 +02:00
|
|
|
orgWebsite: {
|
2019-07-15 19:39:30 +03:00
|
|
|
/**
|
2020-12-28 21:08:27 +02:00
|
|
|
* website of the organization
|
2019-07-15 19:39:30 +03:00
|
|
|
*/
|
|
|
|
|
type: String,
|
|
|
|
|
optional: true,
|
|
|
|
|
max: 255,
|
|
|
|
|
},
|
2021-06-07 11:03:49 +02:00
|
|
|
orgIsActive: {
|
|
|
|
|
/**
|
|
|
|
|
* status of the organization
|
|
|
|
|
*/
|
|
|
|
|
type: Boolean,
|
|
|
|
|
optional: true,
|
|
|
|
|
},
|
2019-07-15 19:39:30 +03:00
|
|
|
createdAt: {
|
|
|
|
|
/**
|
|
|
|
|
* creation date of the organization
|
|
|
|
|
*/
|
|
|
|
|
type: Date,
|
2021-06-07 11:03:49 +02:00
|
|
|
denyUpdate: false,
|
2019-07-15 19:39:30 +03:00
|
|
|
// eslint-disable-next-line consistent-return
|
|
|
|
|
autoValue() {
|
|
|
|
|
if (this.isInsert) {
|
|
|
|
|
return new Date();
|
2019-09-05 12:29:45 -05:00
|
|
|
} else if (this.isUpsert) {
|
|
|
|
|
return { $setOnInsert: new Date() };
|
2019-07-15 19:39:30 +03:00
|
|
|
} else {
|
|
|
|
|
this.unset();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
modifiedAt: {
|
|
|
|
|
type: Date,
|
|
|
|
|
denyUpdate: false,
|
|
|
|
|
// eslint-disable-next-line consistent-return
|
|
|
|
|
autoValue() {
|
|
|
|
|
if (this.isInsert || this.isUpsert || this.isUpdate) {
|
|
|
|
|
return new Date();
|
|
|
|
|
} else {
|
|
|
|
|
this.unset();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
|
2021-02-11 19:07:34 +02:00
|
|
|
if (Meteor.isServer) {
|
2021-06-08 04:38:47 +03:00
|
|
|
Org.allow({
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async insert(userId, doc) {
|
|
|
|
|
const user = await ReactiveCache.getUser(userId) || await ReactiveCache.getCurrentUser();
|
2023-01-15 01:11:16 +01:00
|
|
|
if (user?.isAdmin)
|
2021-06-08 04:38:47 +03:00
|
|
|
return true;
|
|
|
|
|
if (!user) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return doc._id === userId;
|
|
|
|
|
},
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async update(userId, doc) {
|
|
|
|
|
const user = await ReactiveCache.getUser(userId) || await ReactiveCache.getCurrentUser();
|
2023-01-15 01:11:16 +01:00
|
|
|
if (user?.isAdmin)
|
2021-06-08 04:38:47 +03:00
|
|
|
return true;
|
|
|
|
|
if (!user) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return doc._id === userId;
|
|
|
|
|
},
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async remove(userId, doc) {
|
|
|
|
|
const user = await ReactiveCache.getUser(userId) || await ReactiveCache.getCurrentUser();
|
2023-01-15 01:11:16 +01:00
|
|
|
if (user?.isAdmin)
|
2021-06-08 04:38:47 +03:00
|
|
|
return true;
|
|
|
|
|
if (!user) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return doc._id === userId;
|
|
|
|
|
},
|
|
|
|
|
fetch: [],
|
|
|
|
|
});
|
|
|
|
|
|
2021-06-14 15:11:21 +02:00
|
|
|
|
2021-02-11 19:07:34 +02:00
|
|
|
Meteor.methods({
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async setCreateOrg(
|
2021-02-11 19:07:34 +02:00
|
|
|
orgDisplayName,
|
|
|
|
|
orgDesc,
|
|
|
|
|
orgShortName,
|
2023-11-19 23:33:40 +02:00
|
|
|
orgAutoAddUsersWithDomainName,
|
2021-02-11 19:07:34 +02:00
|
|
|
orgWebsite,
|
|
|
|
|
orgIsActive,
|
|
|
|
|
) {
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
if ((await ReactiveCache.getCurrentUser())?.isAdmin) {
|
2021-02-11 19:07:34 +02:00
|
|
|
check(orgDisplayName, String);
|
|
|
|
|
check(orgDesc, String);
|
|
|
|
|
check(orgShortName, String);
|
2023-11-19 23:33:40 +02:00
|
|
|
check(orgAutoAddUsersWithDomainName, String);
|
2021-02-11 19:07:34 +02:00
|
|
|
check(orgWebsite, String);
|
2021-06-07 11:03:49 +02:00
|
|
|
check(orgIsActive, Boolean);
|
2021-02-11 19:07:34 +02:00
|
|
|
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
const nOrgNames = (await ReactiveCache.getOrgs({ orgShortName })).length;
|
2021-02-11 19:07:34 +02:00
|
|
|
if (nOrgNames > 0) {
|
|
|
|
|
throw new Meteor.Error('orgname-already-taken');
|
|
|
|
|
} else {
|
|
|
|
|
Org.insert({
|
|
|
|
|
orgDisplayName,
|
|
|
|
|
orgDesc,
|
|
|
|
|
orgShortName,
|
2023-11-19 23:33:40 +02:00
|
|
|
orgAutoAddUsersWithDomainName,
|
2021-02-11 19:07:34 +02:00
|
|
|
orgWebsite,
|
|
|
|
|
orgIsActive,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async setCreateOrgFromOidc(
|
2022-03-04 18:29:29 +01:00
|
|
|
orgDisplayName,
|
|
|
|
|
orgDesc,
|
|
|
|
|
orgShortName,
|
2023-11-19 23:33:40 +02:00
|
|
|
orgAutoAddUsersWithDomainName,
|
2022-03-04 18:29:29 +01:00
|
|
|
orgWebsite,
|
|
|
|
|
orgIsActive,
|
|
|
|
|
) {
|
|
|
|
|
check(orgDisplayName, String);
|
|
|
|
|
check(orgDesc, String);
|
|
|
|
|
check(orgShortName, String);
|
2023-11-19 23:33:40 +02:00
|
|
|
check(orgAutoAddUsersWithDomainName, String);
|
2022-03-04 18:29:29 +01:00
|
|
|
check(orgWebsite, String);
|
|
|
|
|
check(orgIsActive, Boolean);
|
2021-02-11 19:07:34 +02:00
|
|
|
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
const nOrgNames = (await ReactiveCache.getOrgs({ orgShortName })).length;
|
2022-03-04 18:29:29 +01:00
|
|
|
if (nOrgNames > 0) {
|
|
|
|
|
throw new Meteor.Error('orgname-already-taken');
|
|
|
|
|
} else {
|
|
|
|
|
Org.insert({
|
|
|
|
|
orgDisplayName,
|
|
|
|
|
orgDesc,
|
|
|
|
|
orgShortName,
|
2023-11-19 23:33:40 +02:00
|
|
|
orgAutoAddUsersWithDomainName,
|
2022-03-04 18:29:29 +01:00
|
|
|
orgWebsite,
|
|
|
|
|
orgIsActive,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async setOrgDisplayName(org, orgDisplayName) {
|
|
|
|
|
if ((await ReactiveCache.getCurrentUser())?.isAdmin) {
|
2021-06-07 11:03:49 +02:00
|
|
|
check(org, Object);
|
2021-02-11 19:07:34 +02:00
|
|
|
check(orgDisplayName, String);
|
|
|
|
|
Org.update(org, {
|
2021-12-22 11:49:50 +01:00
|
|
|
$set: { orgDisplayName: orgDisplayName },
|
2021-02-11 19:07:34 +02:00
|
|
|
});
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
await Meteor.callAsync('setUsersOrgsOrgDisplayName', org._id, orgDisplayName);
|
2021-02-11 19:07:34 +02:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async setOrgDesc(org, orgDesc) {
|
|
|
|
|
if ((await ReactiveCache.getCurrentUser())?.isAdmin) {
|
2021-06-07 11:03:49 +02:00
|
|
|
check(org, Object);
|
2021-02-11 19:07:34 +02:00
|
|
|
check(orgDesc, String);
|
|
|
|
|
Org.update(org, {
|
|
|
|
|
$set: { orgDesc: orgDesc },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async setOrgShortName(org, orgShortName) {
|
|
|
|
|
if ((await ReactiveCache.getCurrentUser())?.isAdmin) {
|
2021-06-07 11:03:49 +02:00
|
|
|
check(org, Object);
|
2021-02-11 19:07:34 +02:00
|
|
|
check(orgShortName, String);
|
|
|
|
|
Org.update(org, {
|
|
|
|
|
$set: { orgShortName: orgShortName },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async setAutoAddUsersWithDomainName(org, orgAutoAddUsersWithDomainName) {
|
|
|
|
|
if ((await ReactiveCache.getCurrentUser())?.isAdmin) {
|
2023-11-19 23:33:40 +02:00
|
|
|
check(org, Object);
|
|
|
|
|
check(orgAutoAddUsersWithDomainName, String);
|
|
|
|
|
Org.update(org, {
|
|
|
|
|
$set: { orgAutoAddUsersWithDomainName: orgAutoAddUsersWithDomainName },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async setOrgIsActive(org, orgIsActive) {
|
|
|
|
|
if ((await ReactiveCache.getCurrentUser())?.isAdmin) {
|
2021-06-07 11:03:49 +02:00
|
|
|
check(org, Object);
|
|
|
|
|
check(orgIsActive, Boolean);
|
2021-02-11 19:07:34 +02:00
|
|
|
Org.update(org, {
|
|
|
|
|
$set: { orgIsActive: orgIsActive },
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async setOrgAllFieldsFromOidc(
|
2022-03-10 15:56:35 +01:00
|
|
|
org,
|
|
|
|
|
orgDisplayName,
|
|
|
|
|
orgDesc,
|
|
|
|
|
orgShortName,
|
2023-11-19 23:33:40 +02:00
|
|
|
orgAutoAddUsersWithDomainName,
|
2022-03-10 15:56:35 +01:00
|
|
|
orgWebsite,
|
|
|
|
|
orgIsActive,
|
|
|
|
|
) {
|
|
|
|
|
check(org, Object);
|
|
|
|
|
check(orgDisplayName, String);
|
|
|
|
|
check(orgDesc, String);
|
|
|
|
|
check(orgShortName, String);
|
2023-11-19 23:33:40 +02:00
|
|
|
check(orgAutoAddUsersWithDomainName, String);
|
2022-03-10 15:56:35 +01:00
|
|
|
check(orgWebsite, String);
|
|
|
|
|
check(orgIsActive, Boolean);
|
|
|
|
|
Org.update(org, {
|
|
|
|
|
$set: {
|
|
|
|
|
orgDisplayName: orgDisplayName,
|
|
|
|
|
orgDesc: orgDesc,
|
|
|
|
|
orgShortName: orgShortName,
|
2023-11-19 23:33:40 +02:00
|
|
|
orgAutoAddUsersWithDomainName: orgAutoAddUsersWithDomainName,
|
2022-03-10 15:56:35 +01:00
|
|
|
orgWebsite: orgWebsite,
|
|
|
|
|
orgIsActive: orgIsActive,
|
|
|
|
|
},
|
|
|
|
|
});
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
await Meteor.callAsync('setUsersOrgsOrgDisplayName', org._id, orgDisplayName);
|
2022-03-10 15:56:35 +01:00
|
|
|
},
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
async setOrgAllFields(
|
2021-06-08 04:38:47 +03:00
|
|
|
org,
|
|
|
|
|
orgDisplayName,
|
|
|
|
|
orgDesc,
|
|
|
|
|
orgShortName,
|
2023-11-19 23:33:40 +02:00
|
|
|
orgAutoAddUsersWithDomainName,
|
2021-06-08 04:38:47 +03:00
|
|
|
orgWebsite,
|
|
|
|
|
orgIsActive,
|
|
|
|
|
) {
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
if ((await ReactiveCache.getCurrentUser())?.isAdmin) {
|
2021-06-07 11:03:49 +02:00
|
|
|
check(org, Object);
|
|
|
|
|
check(orgDisplayName, String);
|
|
|
|
|
check(orgDesc, String);
|
|
|
|
|
check(orgShortName, String);
|
2023-11-19 23:33:40 +02:00
|
|
|
check(orgAutoAddUsersWithDomainName, String);
|
2021-06-07 11:03:49 +02:00
|
|
|
check(orgWebsite, String);
|
|
|
|
|
check(orgIsActive, Boolean);
|
|
|
|
|
Org.update(org, {
|
2021-06-08 04:38:47 +03:00
|
|
|
$set: {
|
|
|
|
|
orgDisplayName: orgDisplayName,
|
|
|
|
|
orgDesc: orgDesc,
|
|
|
|
|
orgShortName: orgShortName,
|
2023-11-19 23:33:40 +02:00
|
|
|
orgAutoAddUsersWithDomainName: orgAutoAddUsersWithDomainName,
|
2021-06-08 04:38:47 +03:00
|
|
|
orgWebsite: orgWebsite,
|
|
|
|
|
orgIsActive: orgIsActive,
|
|
|
|
|
},
|
2021-06-07 11:03:49 +02:00
|
|
|
});
|
Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async
Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
checklists, checklistItems, customFields, attachments, integrations,
cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
|
|
|
await Meteor.callAsync('setUsersOrgsOrgDisplayName', org._id, orgDisplayName);
|
2021-06-07 11:03:49 +02:00
|
|
|
}
|
|
|
|
|
},
|
2021-02-11 19:07:34 +02:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-15 22:47:30 +03:00
|
|
|
if (Meteor.isServer) {
|
|
|
|
|
// Index for Organization name.
|
2026-01-24 01:55:29 +02:00
|
|
|
Meteor.startup(async () => {
|
|
|
|
|
// Org._collection.createIndexAsync({ name: -1 });
|
|
|
|
|
await Org._collection.createIndexAsync({ orgDisplayName: 1 });
|
2019-07-15 22:47:30 +03:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-15 19:39:30 +03:00
|
|
|
export default Org;
|