2017-04-12 08:27:57 -04:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
2019-11-29 06:59:40 -05:00
|
|
|
// See LICENSE.txt for license information.
|
2015-09-16 22:59:57 -04:00
|
|
|
|
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
import (
|
2018-02-07 12:05:46 -05:00
|
|
|
"math/big"
|
2015-09-16 22:59:57 -04:00
|
|
|
)
|
|
|
|
|
|
2015-10-15 14:16:26 -04:00
|
|
|
const (
|
2025-09-04 14:46:18 -04:00
|
|
|
SystemServerId = "DiagnosticId"
|
2021-07-12 14:05:36 -04:00
|
|
|
SystemRanUnitTests = "RanUnitTests"
|
|
|
|
|
SystemLastSecurityTime = "LastSecurityTime"
|
|
|
|
|
SystemActiveLicenseId = "ActiveLicenseId"
|
|
|
|
|
SystemLastComplianceTime = "LastComplianceTime"
|
|
|
|
|
SystemAsymmetricSigningKeyKey = "AsymmetricSigningKey"
|
|
|
|
|
SystemPostActionCookieSecretKey = "PostActionCookieSecret"
|
|
|
|
|
SystemInstallationDateKey = "InstallationDate"
|
2023-04-19 09:31:47 -04:00
|
|
|
SystemOrganizationName = "OrganizationName"
|
2023-05-08 16:57:41 -04:00
|
|
|
SystemFirstAdminRole = "FirstAdminRole"
|
2021-07-12 14:05:36 -04:00
|
|
|
SystemFirstServerRunTimestampKey = "FirstServerRunTimestamp"
|
|
|
|
|
SystemClusterEncryptionKey = "ClusterEncryptionKey"
|
2025-11-12 13:16:44 -05:00
|
|
|
SystemPushProxyAuthToken = "PushProxyAuthToken"
|
2021-07-12 14:05:36 -04:00
|
|
|
SystemUpgradedFromTeId = "UpgradedFromTE"
|
|
|
|
|
SystemWarnMetricNumberOfTeams5 = "warn_metric_number_of_teams_5"
|
|
|
|
|
SystemWarnMetricNumberOfChannels50 = "warn_metric_number_of_channels_50"
|
|
|
|
|
SystemWarnMetricMfa = "warn_metric_mfa"
|
|
|
|
|
SystemWarnMetricEmailDomain = "warn_metric_email_domain"
|
|
|
|
|
SystemWarnMetricNumberOfActiveUsers100 = "warn_metric_number_of_active_users_100"
|
|
|
|
|
SystemWarnMetricNumberOfActiveUsers200 = "warn_metric_number_of_active_users_200"
|
|
|
|
|
SystemWarnMetricNumberOfActiveUsers300 = "warn_metric_number_of_active_users_300"
|
|
|
|
|
SystemWarnMetricNumberOfActiveUsers500 = "warn_metric_number_of_active_users_500"
|
|
|
|
|
SystemWarnMetricNumberOfPosts2m = "warn_metric_number_of_posts_2M"
|
|
|
|
|
SystemWarnMetricLastRunTimestampKey = "LastWarnMetricRunTimestamp"
|
|
|
|
|
SystemFirstAdminVisitMarketplace = "FirstAdminVisitMarketplace"
|
2022-02-25 14:56:40 -05:00
|
|
|
SystemFirstAdminSetupComplete = "FirstAdminSetupComplete"
|
2022-07-06 02:26:39 -04:00
|
|
|
SystemLastAccessiblePostTime = "LastAccessiblePostTime"
|
2022-09-28 12:52:53 -04:00
|
|
|
SystemLastAccessibleFileTime = "LastAccessibleFileTime"
|
2023-02-02 16:48:59 -05:00
|
|
|
SystemHostedPurchaseNeedsScreening = "HostedPurchaseNeedsScreening"
|
2026-03-09 14:07:44 -04:00
|
|
|
SystemPostChannelTypeBackfillComplete = "PostChannelTypeBackfillComplete"
|
2021-07-12 14:05:36 -04:00
|
|
|
AwsMeteringReportInterval = 1
|
|
|
|
|
AwsMeteringDimensionUsageHrs = "UsageHrs"
|
2024-01-11 13:07:41 -05:00
|
|
|
CloudRenewalEmail = "CloudRenewalEmail"
|
2020-07-22 23:32:21 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
2021-07-12 14:05:36 -04:00
|
|
|
WarnMetricStatusLimitReached = "true"
|
|
|
|
|
WarnMetricStatusRunonce = "runonce"
|
|
|
|
|
WarnMetricStatusAck = "ack"
|
|
|
|
|
WarnMetricStatusStorePrefix = "warn_metric_"
|
|
|
|
|
WarnMetricJobInterval = 24 * 7
|
|
|
|
|
WarnMetricNumberOfActiveUsers25 = 25
|
|
|
|
|
WarnMetricJobWaitTime = 1000 * 3600 * 24 * 7 // 7 days
|
2015-10-15 14:16:26 -04:00
|
|
|
)
|
|
|
|
|
|
2015-09-16 22:59:57 -04:00
|
|
|
type System struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Value string `json:"value"`
|
|
|
|
|
}
|
|
|
|
|
|
MM-10516: Added support for PostActions in ephemeral posts (#10258)
* Added support for PostActions in ephemeral posts
The general approach is that we take all the metadata that DoPostAction
needs to process client DoPostActionRequests, and store it in a
serialized, encrypted Cookie field, in the PostAction struct.
The client then must send it back, and it is then used to process
PostActions as a fallback top the metadata in the database.
This PR adds a new config setting, `ServiceSettings.ActionCookieSecret`.
In a cluster environment it must be the same for all instances.
- Added type PostActionCookie, and a Cookie string to PostAction.
- Added App.AddActionCookiesToPost.
- Use App.AddActionCookiesToPost in api4.createEphemeralPost,
App.SendEphemeralPost, App.UpdateEphemeralPost.
- Added App.DoPostActionWithCookie to process incoming requests with
cookies. For backward compatibility, it prefers the metadata in the
database; falls back to cookie.
- Added plugin.API.UpdateEphemeralPost and plugin.API.DeleteEphemeralPost.
- Added App.encryptActionCookie/App.decryptActionCookie.
* Style
* Fixed an unfortunate typo, tested with matterpoll
* minor PR feedback
* Fixed uninitialized Context
* Fixed another test failure
* Fixed permission check
* Added api test for DoPostActionWithCookie
* Replaced config.ActionCookieSecret with Server.PostActionCookieSecret
Modeled after AsymetricSigningKey
* style
* Set DeleteAt in DeleteEphemeralPost
* PR feedback
* Removed deadwood comment
* Added EXPERIMENTAL comment to the 2 APIs in question
2019-03-01 13:15:31 -05:00
|
|
|
type SystemPostActionCookieSecret struct {
|
|
|
|
|
Secret []byte `json:"key,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-07 12:05:46 -05:00
|
|
|
type SystemAsymmetricSigningKey struct {
|
|
|
|
|
ECDSAKey *SystemECDSAKey `json:"ecdsa_key,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SystemECDSAKey struct {
|
|
|
|
|
Curve string `json:"curve"`
|
|
|
|
|
X *big.Int `json:"x"`
|
|
|
|
|
Y *big.Int `json:"y"`
|
|
|
|
|
D *big.Int `json:"d,omitempty"`
|
|
|
|
|
}
|
2019-11-27 20:41:09 -05:00
|
|
|
|
2019-12-03 12:56:40 -05:00
|
|
|
// ServerBusyState provides serialization for app.Busy.
|
2019-11-27 20:41:09 -05:00
|
|
|
type ServerBusyState struct {
|
2021-07-12 14:05:36 -04:00
|
|
|
Busy bool `json:"busy"`
|
|
|
|
|
Expires int64 `json:"expires"`
|
|
|
|
|
ExpiresTS string `json:"expires_ts,omitempty"`
|
2019-11-27 20:41:09 -05:00
|
|
|
}
|
|
|
|
|
|
2022-03-15 09:39:23 -04:00
|
|
|
type AppliedMigration struct {
|
|
|
|
|
Version int `json:"version"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
}
|
2023-02-14 05:39:10 -05:00
|
|
|
|
|
|
|
|
type LogFilter struct {
|
|
|
|
|
ServerNames []string `json:"server_names"`
|
|
|
|
|
LogLevels []string `json:"log_levels"`
|
|
|
|
|
DateFrom string `json:"date_from"`
|
|
|
|
|
DateTo string `json:"date_to"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type LogEntry struct {
|
|
|
|
|
Timestamp string
|
|
|
|
|
Level string
|
|
|
|
|
}
|
2024-02-20 08:22:28 -05:00
|
|
|
|
|
|
|
|
// SystemPingOptions is the options for setting contents of the system ping
|
|
|
|
|
// response.
|
|
|
|
|
type SystemPingOptions struct {
|
|
|
|
|
// FullStatus allows server to set the detailed information about
|
|
|
|
|
// the system status.
|
|
|
|
|
FullStatus bool
|
|
|
|
|
// RestSemantics allows server to return 200 code even if the server
|
|
|
|
|
// status is unhealthy.
|
|
|
|
|
RESTSemantics bool
|
|
|
|
|
}
|