mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-08-19 10:26:03 +00:00
Implement -audit-log option.
Also, record the principal of `git-pages -{freeze,unfreeze}-domain`
and `git-pages -update-site` as the CLI administrator.
This commit is contained in:
@@ -87,6 +87,37 @@ func DecodeAuditRecord(data []byte) (record *AuditRecord, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (record *AuditRecord) GetAuditID() AuditID {
|
||||
return AuditID(record.GetId())
|
||||
}
|
||||
|
||||
func (record *AuditRecord) DescribePrincipal() string {
|
||||
var items []string
|
||||
if record.Principal != nil {
|
||||
if record.Principal.GetIpAddress() != "" {
|
||||
items = append(items, record.Principal.GetIpAddress())
|
||||
}
|
||||
if record.Principal.GetCliAdmin() {
|
||||
items = append(items, "<cli-admin>")
|
||||
}
|
||||
}
|
||||
if len(items) > 0 {
|
||||
return strings.Join(items, ";")
|
||||
} else {
|
||||
return "<unknown>"
|
||||
}
|
||||
}
|
||||
|
||||
func (record *AuditRecord) DescribeResource() string {
|
||||
desc := "<unknown>"
|
||||
if record.Domain != nil && record.Project != nil {
|
||||
desc = fmt.Sprintf("%s/%s", *record.Domain, *record.Project)
|
||||
} else if record.Domain != nil {
|
||||
desc = *record.Domain
|
||||
}
|
||||
return desc
|
||||
}
|
||||
|
||||
type AuditRecordScope int
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user