MM-51321 Refactor audit log application. (#22481)
* Refactor audit log application. * Fix incorrect API Usage for Auditing * Fixups. * Rename Object audit to Auditable. Some small fixes. --------- Co-authored-by: Daniel Schalla <daniel@schalla.me>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9a38a52392
Коммит
7804debb7f
@@ -41,6 +41,19 @@ type RemoteCluster struct {
|
||||
CreatorId string `json:"creator_id"`
|
||||
}
|
||||
|
||||
func (rc *RemoteCluster) Auditable() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"remote_id": rc.RemoteId,
|
||||
"remote_team_id": rc.RemoteTeamId,
|
||||
"name": rc.Name,
|
||||
"display_name": rc.DisplayName,
|
||||
"site_url": rc.SiteURL,
|
||||
"create_at": rc.CreateAt,
|
||||
"last_ping_at": rc.LastPingAt,
|
||||
"creator_id": rc.CreatorId,
|
||||
}
|
||||
}
|
||||
|
||||
func (rc *RemoteCluster) PreSave() {
|
||||
if rc.RemoteId == "" {
|
||||
rc.RemoteId = NewId()
|
||||
@@ -154,6 +167,13 @@ type RemoteClusterFrame struct {
|
||||
Msg RemoteClusterMsg `json:"msg"`
|
||||
}
|
||||
|
||||
func (f *RemoteClusterFrame) Auditable() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"remote_id": f.RemoteId,
|
||||
"msg": f.Msg,
|
||||
}
|
||||
}
|
||||
|
||||
func (f *RemoteClusterFrame) IsValid() *AppError {
|
||||
if !IsValidId(f.RemoteId) {
|
||||
return NewAppError("RemoteClusterFrame.IsValid", "api.remote_cluster.invalid_id.app_error", nil, "RemoteId="+f.RemoteId, http.StatusBadRequest)
|
||||
|
||||
Ссылка в новой задаче
Block a user