Files
RenewCMS/internal/domain/audit/auditOwnership.go
T

20 lines
416 B
Go

package audit
import "strconv"
func (e Event) ConcernsOtherPerson(userID uint32, ownAuthorID *uint32) bool {
switch e.Target.Type {
case TargetUser:
return e.Target.ID != formatID(userID)
case TargetInvite:
return true
case TargetAuthor:
return ownAuthorID == nil || e.Target.ID != formatID(*ownAuthorID)
}
return false
}
func formatID(id uint32) string {
return strconv.FormatUint(uint64(id), 10)
}