Files
wekan/models/org.js
T
Lauri Ojansivu bb4a013939 Collection schemas share one createdAt and one modifiedAt autoValue.
34 schema files wrote the same two autoValue functions out by hand, 65
times in five spellings: createdAt set on insert and $setOnInsert on upsert,
unset otherwise; modifiedAt set on every write. They are now
createdAtAutoValue and modifiedAtAutoValue in models/lib/schemaTimestamps.js,
named by each field as `autoValue: createdAtAutoValue`. models/settings.js,
which may not use import statements, requires them.

Schemas whose rule differs keep their own: changeHistory keeps a createdAt
the caller set, and listSyncCredentials' updatedAt does not unset.

tests/schemaTimestamps runs both functions in SimpleSchema's insert, upsert,
update and validation contexts, and fails when a schema writes either one
out by hand again.

Thanks to xet7 !
2026-11-21 18:27:03 +02:00

189 lines
4.8 KiB
JavaScript

import { Mongo } from 'meteor/mongo';
import { ReactiveCache } from '/imports/reactiveCache';
import { createdAtAutoValue, modifiedAtAutoValue } from '/models/lib/schemaTimestamps';
const { SimpleSchema } = require('/imports/simpleSchema');
const Org = new Mongo.Collection('org');
/**
* A Organization in WeKan. A Enterprise in Trello.
*/
Org.attachSchema(
new SimpleSchema({
orgDisplayName: {
/**
* the name to display for the organization
*/
type: String,
optional: true,
},
orgDesc: {
/**
* the description the organization
*/
type: String,
optional: true,
max: 190,
},
orgShortName: {
/**
* short name of the organization
*/
type: String,
optional: true,
max: 255,
},
orgAutoAddUsersWithDomainName: {
/**
* automatically add users with domain name
*/
type: String,
optional: true,
max: 255,
},
orgWebsite: {
/**
* website of the organization
*/
type: String,
optional: true,
max: 255,
},
orgIsActive: {
/**
* status of the organization
*/
type: Boolean,
optional: true,
},
orgSharedTemplates: {
/**
* #5850: members may drag personal Template Boards onto this org to share
* (per-org form of "Shared Templates for Organizations"). Off by default.
*/
type: Boolean,
optional: true,
},
orgPropagateMembersToBoards: {
/**
* #4737: add this org's members to the boards that list this org. Off by default.
*/
type: Boolean,
optional: true,
},
orgSyncMembersFromAuth: {
/**
* #4737: this org's membership is maintained by the authentication
* provider's group/membership sync (LDAP, OAuth2/OIDC, SAML, etc.). Off by default.
*/
type: Boolean,
optional: true,
},
orgDomains: {
/**
* Multitenancy option D (docs/Design/Multitenancy/Multitenancy.md): the
* hostname(s) this Organization is served on, free text separated by commas,
* semicolons or whitespace - e.g. "a.example.com, kanban.example.org". A
* request whose host matches one of these is that tenant's request, and the
* org's branding below replaces the instance branding for it. Empty (the
* default) means the org is not a tenant and nothing changes.
* Only read when the deployment sets MULTITENANCY=true.
*/
type: String,
optional: true,
max: 1000,
},
orgDomainsRequested: {
/**
* Hostnames this Organization's own admin asked for and a site admin has
* not yet assigned (2026-10-02: only a site admin assigns a hostname).
* Not in effect until then.
*/
type: String,
optional: true,
max: 1000,
},
orgProductName: {
/**
* Per-tenant branding. Each of these overrides the SAME-named instance
* setting of Admin Panel / Settings / Visibility for this tenant's requests,
* and an empty one leaves the instance value alone - so a tenant overrides
* only what it sets. See models/lib/tenants.js BRANDING_FIELDS.
*/
type: String,
optional: true,
max: 255,
},
orgThemeColor: {
/**
* The site theme for this Organization's hosts - the layer between WeKan's
* default theme and a user's own override (docs/Theme/Theme.md). Set in
* Admin Panel / Settings / Visibility / Change color.
*/
type: String,
optional: true,
max: 255,
},
orgThemeCustomColors: {
/**
* The custom colours of that theme, for the flat (1 colour) and clear
* (2 colours, a gradient) categories.
*/
type: Array,
optional: true,
},
'orgThemeCustomColors.$': {
type: String,
optional: true,
},
orgCustomLoginLogoImageUrl: {
type: String,
optional: true,
max: 1000,
},
orgCustomLoginLogoLinkUrl: {
type: String,
optional: true,
max: 1000,
},
orgTextBelowCustomLoginLogo: {
type: String,
optional: true,
max: 1000,
},
orgCustomTopLeftCornerLogoImageUrl: {
type: String,
optional: true,
max: 1000,
},
orgCustomTopLeftCornerLogoLinkUrl: {
type: String,
optional: true,
max: 1000,
},
orgCustomHelpLinkUrl: {
type: String,
optional: true,
max: 1000,
},
orgLegalNotice: {
type: String,
optional: true,
max: 1000,
},
createdAt: {
/**
* creation date of the organization
*/
type: Date,
autoValue: createdAtAutoValue,
},
modifiedAt: {
type: Date,
autoValue: modifiedAtAutoValue,
},
}),
);
export default Org;