summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/mattermost-server/v5/model/auditconv.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2021-10-17 00:47:22 +0200
committerGitHub <noreply@github.com>2021-10-17 00:47:22 +0200
commit4dd8bae5c91fa4aef09d865d8fef1acd84f90925 (patch)
treeffad9b242daccaf8c86d1c1fbd59032302bd3be9 /vendor/github.com/mattermost/mattermost-server/v5/model/auditconv.go
parent7ae45c42e712bd0e66c101f3f714c05aa1dc2104 (diff)
downloadmatterbridge-msglm-4dd8bae5c91fa4aef09d865d8fef1acd84f90925.tar.gz
matterbridge-msglm-4dd8bae5c91fa4aef09d865d8fef1acd84f90925.tar.bz2
matterbridge-msglm-4dd8bae5c91fa4aef09d865d8fef1acd84f90925.zip
Update dependencies (#1610)
* Update dependencies * Update module to go 1.17
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v5/model/auditconv.go')
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v5/model/auditconv.go48
1 files changed, 47 insertions, 1 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/auditconv.go b/vendor/github.com/mattermost/mattermost-server/v5/model/auditconv.go
index 50af2880..b3cf6062 100644
--- a/vendor/github.com/mattermost/mattermost-server/v5/model/auditconv.go
+++ b/vendor/github.com/mattermost/mattermost-server/v5/model/auditconv.go
@@ -3,7 +3,9 @@
package model
-import "github.com/francoispqt/gojay"
+import (
+ "github.com/francoispqt/gojay"
+)
// AuditModelTypeConv converts key model types to something better suited for audit output.
func AuditModelTypeConv(val interface{}) (newVal interface{}, converted bool) {
@@ -49,6 +51,8 @@ func AuditModelTypeConv(val interface{}) (newVal interface{}, converted bool) {
return newAuditIncomingWebhook(v), true
case *OutgoingWebhook:
return newAuditOutgoingWebhook(v), true
+ case *RemoteCluster:
+ return newRemoteCluster(v), true
}
return val, false
}
@@ -665,3 +669,45 @@ func (h auditOutgoingWebhook) MarshalJSONObject(enc *gojay.Encoder) {
func (h auditOutgoingWebhook) IsNil() bool {
return false
}
+
+type auditRemoteCluster struct {
+ RemoteId string
+ RemoteTeamId string
+ Name string
+ DisplayName string
+ SiteURL string
+ CreateAt int64
+ LastPingAt int64
+ CreatorId string
+}
+
+// newRemoteCluster creates a simplified representation of RemoteCluster for output to audit log.
+func newRemoteCluster(r *RemoteCluster) auditRemoteCluster {
+ var rc auditRemoteCluster
+ if r != nil {
+ rc.RemoteId = r.RemoteId
+ rc.RemoteTeamId = r.RemoteTeamId
+ rc.Name = r.Name
+ rc.DisplayName = r.DisplayName
+ rc.SiteURL = r.SiteURL
+ rc.CreateAt = r.CreateAt
+ rc.LastPingAt = r.LastPingAt
+ rc.CreatorId = r.CreatorId
+ }
+ return rc
+}
+
+func (r auditRemoteCluster) MarshalJSONObject(enc *gojay.Encoder) {
+ enc.StringKey("remote_id", r.RemoteId)
+ enc.StringKey("remote_team_id", r.RemoteTeamId)
+ enc.StringKey("name", r.Name)
+ enc.StringKey("display_name", r.DisplayName)
+ enc.StringKey("site_url", r.SiteURL)
+ enc.Int64Key("create_at", r.CreateAt)
+ enc.Int64Key("last_ping_at", r.LastPingAt)
+ enc.StringKey("creator_id", r.CreatorId)
+}
+
+func (r auditRemoteCluster) IsNil() bool {
+ return false
+}