added audit log messages that had previously been "missing," for community and conference changes

This commit is contained in:
2026-02-22 14:59:38 -07:00
parent 8dcfa79983
commit ac22181a19
5 changed files with 39 additions and 4 deletions
+19 -1
View File
@@ -464,7 +464,7 @@ func (c *Community) SaveFlags(ctx context.Context, f *util.OptionSet) error {
// SetProfileData sets all the "settable" profile data
func (c *Community) SetProfileData(ctx context.Context, name string, alias string, synopsis *string, rules *string, language *string,
joinkey *string, membersonly bool, hideDirectory bool, hideSearch bool, read_lvl uint16, write_lvl uint16,
create_lvl uint16, delete_lvl uint16, join_lvl uint16) error {
create_lvl uint16, delete_lvl uint16, join_lvl uint16, u *User, ipaddr string) error {
c.Mutex.Lock()
defer c.Mutex.Unlock()
_, err := amdb.ExecContext(ctx, `UPDATE communities SET commname = ?, alias = ?, synopsis = ?, rules = ?, language = ?,
@@ -473,6 +473,24 @@ func (c *Community) SetProfileData(ctx context.Context, name string, alias strin
name, alias, synopsis, rules, language, joinkey, membersonly, hideDirectory, hideSearch, read_lvl, write_lvl,
create_lvl, delete_lvl, join_lvl, c.Id)
if err == nil {
if name != c.Name {
AmStoreAudit(AmNewCommAudit(AuditCommunityName, u.Uid, c.Id, ipaddr, fmt.Sprintf("name=%s", name)))
}
if alias != c.Alias {
AmStoreAudit(AmNewCommAudit(AuditCommunityAlias, u.Uid, c.Id, ipaddr, fmt.Sprintf("alias=%s", alias)))
}
if (hideDirectory != c.HideFromDirectory) || (hideSearch != c.HideFromSearch) {
AmStoreAudit(AmNewCommAudit(AuditCommunityHideInfo, u.Uid, c.Id, ipaddr, fmt.Sprintf("directory=%t, search=%t", hideDirectory, hideSearch)))
}
if membersonly != c.MembersOnly {
AmStoreAudit(AmNewCommAudit(AuditCommunityMembersOnly, u.Uid, c.Id, ipaddr, fmt.Sprintf("flag=%t", membersonly)))
}
if joinkey != c.JoinKey {
AmStoreAudit(AmNewCommAudit(AuditCommunityJoinKey, u.Uid, c.Id, ipaddr))
}
if (read_lvl != c.ReadLevel) || (write_lvl != c.WriteLevel) || (create_lvl != c.CreateLevel) || (delete_lvl != c.DeleteLevel) || (join_lvl != c.JoinLevel) {
AmStoreAudit(AmNewCommAudit(AuditCommunitySecurity, u.Uid, c.Id, ipaddr))
}
c.Name = name
c.Alias = alias
c.Synopsis = synopsis
+15 -1
View File
@@ -457,7 +457,8 @@ func (c *Conference) Link(ctx context.Context, scope string) (string, error) {
}
// SetInfo sets the name, pseud, and security levels on a conference.
func (c *Conference) SetInfo(ctx context.Context, name, descr string, read_lvl, post_lvl, create_lvl, hide_lvl, nuke_lvl, change_lvl, delete_lvl uint16) error {
func (c *Conference) SetInfo(ctx context.Context, name, descr string, read_lvl, post_lvl, create_lvl, hide_lvl, nuke_lvl, change_lvl, delete_lvl uint16,
u *User, comm *Community, ipaddr string) error {
c.Mutex.Lock()
defer c.Mutex.Unlock()
_, err := amdb.ExecContext(ctx, `UPDATE confs SET name = ?, descr = ?, read_lvl = ?, post_lvl = ?, create_lvl = ?,
@@ -470,6 +471,19 @@ func (c *Conference) SetInfo(ctx context.Context, name, descr string, read_lvl,
if len(tmp) != 1 {
err = errors.New("internal error rereading conference")
} else {
if c.Name != tmp[0].Name {
AmStoreAudit(AmNewCommAudit(AuditConferenceName, u.Uid, comm.Id, ipaddr, fmt.Sprintf("confid=%d", c.ConfId), fmt.Sprintf("name='%s'", tmp[0].Name)))
}
deltaSecurity := false
if (c.ReadLevel != tmp[0].ReadLevel) || (c.PostLevel != tmp[0].PostLevel) || (c.CreateLevel != tmp[0].CreateLevel) || (c.HideLevel != tmp[0].HideLevel) {
deltaSecurity = true
}
if (c.NukeLevel != tmp[0].NukeLevel) || (c.ChangeLevel != tmp[0].ChangeLevel) || (c.DeleteLevel != tmp[0].DeleteLevel) {
deltaSecurity = true
}
if deltaSecurity {
AmStoreAudit(AmNewCommAudit(AuditConferenceSecurity, u.Uid, comm.Id, ipaddr, fmt.Sprintf("confid=%d", c.ConfId)))
}
c.Name = tmp[0].Name
c.Description = tmp[0].Description
c.ReadLevel = tmp[0].ReadLevel
+2
View File
@@ -194,6 +194,8 @@ func (ci *ContactInfo) Save(ctx context.Context, changer *User, ipaddr string) (
if changer.Uid != ci.OwnerUid {
AmStoreAudit(AmNewAudit(AuditAdminSetUserContactInfo, changer.Uid, ipaddr, fmt.Sprintf("uid=%d", ci.OwnerUid), fmt.Sprintf("contactid=%d", ci.ContactId)))
}
} else {
AmStoreAudit(AmNewCommAudit(AuditCommunityContactInfo, changer.Uid, ci.OwnerCommId, ipaddr, fmt.Sprintf("contactid=%d", ci.ContactId)))
}
return emailChange, err
}