mirror of
https://github.com/mattermost/mattermost.git
synced 2026-04-13 04:57:45 -04:00
* Add audit logging for recap API endpoints - Add audit event constants for all recap operations - Implement Auditable interface for Recap model - Add comprehensive audit logging to all 6 recap endpoints - Log channel_ids to track implicit channel content access - Use LevelContent for content-related operations, LevelAPI for listing * Address PR feedback: standardize audit method order and extract helper function - Standardized order of audit record method calls across all handlers: set object type first, then prior state (if applicable), then result state - Extracted duplicated channel ID extraction logic into addRecapChannelIDsToAuditRec helper function
75 lines
2.3 KiB
Go
75 lines
2.3 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package model
|
|
|
|
type Recap struct {
|
|
Id string `json:"id"`
|
|
UserId string `json:"user_id"`
|
|
Title string `json:"title"`
|
|
CreateAt int64 `json:"create_at"`
|
|
UpdateAt int64 `json:"update_at"`
|
|
DeleteAt int64 `json:"delete_at"`
|
|
ReadAt int64 `json:"read_at"`
|
|
TotalMessageCount int `json:"total_message_count"`
|
|
Status string `json:"status"`
|
|
BotID string `json:"bot_id"`
|
|
Channels []*RecapChannel `json:"channels,omitempty"`
|
|
}
|
|
|
|
type RecapChannel struct {
|
|
Id string `json:"id"`
|
|
RecapId string `json:"recap_id"`
|
|
ChannelId string `json:"channel_id"`
|
|
ChannelName string `json:"channel_name"`
|
|
Highlights []string `json:"highlights"`
|
|
ActionItems []string `json:"action_items"`
|
|
SourcePostIds []string `json:"source_post_ids"`
|
|
CreateAt int64 `json:"create_at"`
|
|
}
|
|
|
|
type CreateRecapRequest struct {
|
|
Title string `json:"title"`
|
|
ChannelIds []string `json:"channel_ids"`
|
|
AgentID string `json:"agent_id"`
|
|
}
|
|
|
|
type AIRecapSummaryResponse struct {
|
|
Highlights []string `json:"highlights"`
|
|
ActionItems []string `json:"action_items"`
|
|
}
|
|
|
|
// RecapChannelResult represents the result of processing a single channel for a recap
|
|
type RecapChannelResult struct {
|
|
ChannelID string
|
|
MessageCount int
|
|
Success bool
|
|
}
|
|
|
|
const (
|
|
RecapStatusPending = "pending"
|
|
RecapStatusProcessing = "processing"
|
|
RecapStatusCompleted = "completed"
|
|
RecapStatusFailed = "failed"
|
|
)
|
|
|
|
// Auditable returns safe-to-log fields for audit logging
|
|
func (r *Recap) Auditable() map[string]any {
|
|
channelIDs := make([]string, 0, len(r.Channels))
|
|
for _, channel := range r.Channels {
|
|
channelIDs = append(channelIDs, channel.ChannelId)
|
|
}
|
|
|
|
return map[string]any{
|
|
"id": r.Id,
|
|
"user_id": r.UserId,
|
|
"title": r.Title,
|
|
"status": r.Status,
|
|
"channel_ids": channelIDs,
|
|
"total_message_count": r.TotalMessageCount,
|
|
"bot_id": r.BotID,
|
|
"create_at": r.CreateAt,
|
|
"update_at": r.UpdateAt,
|
|
"read_at": r.ReadAt,
|
|
}
|
|
}
|