mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Admin Panel / People / Cloud names the Cloud Panel Domain and its SuperAdmin - an existing administrator, by username or e-mail address - as Weddy's Cloud Panel does (caddy-wekan-plugin). At that domain, /cloud is an Admin-Panel-style page: - Domains, a table page: domain, customer name and e-mail, billing e-mail, start and end date, and where its data is - its own WeKan container and MongoDB database (connection string, or host, port, database, username, password, authentication database, replica set, TLS; no password is fine), or shared with this WeKan as an Organization claiming the domain. Passwords are written on the server and never sent back. - Import into this WeKan: a domain's own WeKan database merged into this one - its boards and all hanging off them, accounts matched by e-mail address or created (never administrators, no login tokens), everybody in the domain's Organization - and the domain then shares this WeKan. A dry run first. Ten containers and ten databases become one of each. - Invoices of the hosting, recorded by the SuperAdmin, earlier ones too; each customer sees their own, paid or not and when. - Chat per domain between its customer and the SuperAdmin, with earlier Rocket.Chat and SandChat conversations imported. - CloudFlare: the DNS records of every domain, created and updated; a record of another kind is reported, never replaced. - Caddy: the Caddyfile of every domain, loaded through its admin API. The panel answers only at its own domain, checked on the server by every method. A shared domain's Organization claims its host only after the same refusals as an Organization admin's: never the instance's own address, never another Organization's (TenantBleed). Requests go only to CloudFlare's API and the Caddy admin API an administrator set, without redirects (SyncBleed). 44 new strings are translated in every language. Lower-confidence translations: chr, ay, ak, bm, ee, bi, ace, bo, dz, bua, cv, ba, csb, bho, an, co, ff, fj, gn, gv, haw, iu, kl, kw, ks, kok, ig, ha, fur, hsb, ht, la, lg, lld, mg, mi, nah, nap, nd, nso, ny, om, pap, qu, rm, rn, rup, rw, sah, sc, scn, se, sm, sn, so, ss, tlh, vo, wal, ve-PP, wa, wa-RR, szl, zgh, tig, ve, ts, tn, st, wo, to, tpi, yi, uz-AR, wuu-Hans, yue_CN, ve-CC and vl-SS. Thanks to xet7 !
92 lines
4.6 KiB
JavaScript
92 lines
4.6 KiB
JavaScript
// Cloud Panel (docs/Features/Admin-Panel/Cloud-Panel.md): the collections of
|
|
// the hosting operator's panel. Every write goes through a method in
|
|
// server/cloudPanel.js and nothing here is published: a database password or a
|
|
// Cloudflare token must never reach a browser, and a customer sees only their
|
|
// own invoices and chat, through those methods.
|
|
import { Meteor } from 'meteor/meteor';
|
|
import { Mongo } from 'meteor/mongo';
|
|
import { createdAtAutoValue, modifiedAtAutoValue } from '/models/lib/schemaTimestamps';
|
|
const { SimpleSchema } = require('/imports/simpleSchema');
|
|
|
|
const day = /^\d{4}-\d\d-\d\d$/;
|
|
|
|
// One document, _id 'cloud': the panel's domain and Cloud Admins, Cloudflare
|
|
// and Caddy (models/lib/cloudPanel.js normalizeCloudSettings, normalizeCloudflare,
|
|
// normalizeCaddy).
|
|
export const CloudSettings = new Mongo.Collection('cloudSettings');
|
|
CloudSettings.attachSchema(new SimpleSchema({
|
|
settings: { type: Object, optional: true, blackbox: true },
|
|
cloudflare: { type: Object, optional: true, blackbox: true },
|
|
caddy: { type: Object, optional: true, blackbox: true },
|
|
createdAt: { type: Date, optional: true, autoValue: createdAtAutoValue },
|
|
modifiedAt: { type: Date, optional: true, autoValue: modifiedAtAutoValue },
|
|
}));
|
|
|
|
// The customer domains: each with its own database and container, or shared
|
|
// with this WeKan as an Organization.
|
|
export const CloudDomains = new Mongo.Collection('cloudDomains');
|
|
CloudDomains.attachSchema(new SimpleSchema({
|
|
domain: { type: String, max: 253 },
|
|
customerName: { type: String, optional: true, max: 200 },
|
|
// As Weddy's Domains table has them: who the customer is, where their
|
|
// invoices go, and the hosting's first and last day.
|
|
customerEmail: { type: String, optional: true, max: 254 },
|
|
billingEmail: { type: String, optional: true, max: 254 },
|
|
startDate: { type: String, optional: true, regEx: day },
|
|
endDate: { type: String, optional: true, regEx: day },
|
|
mode: { type: String, allowedValues: ['own', 'shared'] },
|
|
upstream: { type: String, optional: true, max: 260 },
|
|
database: { type: Object, optional: true, blackbox: true },
|
|
customerUsernames: { type: Array, optional: true },
|
|
'customerUsernames.$': { type: String, max: 100 },
|
|
notes: { type: String, optional: true, max: 2000 },
|
|
cloudflare: { type: Boolean, optional: true },
|
|
// The Organization a shared domain is (models/org.js), and the last import.
|
|
orgId: { type: String, optional: true },
|
|
importedAt: { type: Date, optional: true },
|
|
importReport: { type: Object, optional: true, blackbox: true },
|
|
createdAt: { type: Date, optional: true, autoValue: createdAtAutoValue },
|
|
modifiedAt: { type: Date, optional: true, autoValue: modifiedAtAutoValue },
|
|
}));
|
|
|
|
// The hosting invoices of a domain's customer, kept here - also the ones from
|
|
// before the panel, recorded by a Cloud Admin.
|
|
export const CloudInvoices = new Mongo.Collection('cloudInvoices');
|
|
CloudInvoices.attachSchema(new SimpleSchema({
|
|
domainId: { type: String },
|
|
number: { type: String, max: 50 },
|
|
issueDate: { type: String, regEx: day },
|
|
dueDate: { type: String, optional: true, regEx: day },
|
|
amountMinor: { type: Number, min: 0 },
|
|
currency: { type: String, regEx: /^[A-Z]{3}$/ },
|
|
status: { type: String, allowedValues: ['open', 'paid', 'void'] },
|
|
paidDate: { type: String, optional: true, regEx: day },
|
|
description: { type: String, optional: true, max: 1000 },
|
|
link: { type: String, optional: true, max: 500 },
|
|
createdBy: { type: String, optional: true },
|
|
createdAt: { type: Date, optional: true, autoValue: createdAtAutoValue },
|
|
modifiedAt: { type: Date, optional: true, autoValue: modifiedAtAutoValue },
|
|
}));
|
|
|
|
// The chat of a domain's customer with the Cloud Admins, and the Rocket.Chat
|
|
// and SandChat conversations imported into it.
|
|
export const CloudChatMessages = new Mongo.Collection('cloudChatMessages');
|
|
CloudChatMessages.attachSchema(new SimpleSchema({
|
|
domainId: { type: String },
|
|
userId: { type: String, optional: true },
|
|
authorName: { type: String, optional: true, max: 200 },
|
|
text: { type: String, max: 20000 },
|
|
// Where an imported message came from, and its room there.
|
|
source: { type: String, optional: true, allowedValues: ['rocketchat', 'sandchat'] },
|
|
room: { type: String, optional: true, max: 200 },
|
|
at: { type: Date },
|
|
createdAt: { type: Date, optional: true, autoValue: createdAtAutoValue },
|
|
}));
|
|
|
|
// No client writes, to any of them: the methods are the only way in.
|
|
if (Meteor.isServer) {
|
|
for (const collection of [CloudSettings, CloudDomains, CloudInvoices, CloudChatMessages]) {
|
|
collection.deny({ insert: () => true, update: () => true, remove: () => true });
|
|
}
|
|
}
|