From 2a348c7f912a17dbb0d29624cb3bef2add9d7492 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Fri, 25 Oct 2024 16:23:22 +0900 Subject: system: include more info in ACL Stringer Signed-off-by: Ophestra Umiker --- acl/export.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'acl') diff --git a/acl/export.go b/acl/export.go index 104de517..13a2a3f3 100644 --- a/acl/export.go +++ b/acl/export.go @@ -25,7 +25,25 @@ const ( Other = C.ACL_OTHER ) -type Perm C.acl_perm_t +type ( + Perm C.acl_perm_t + Perms []Perm +) + +func (ps Perms) String() string { + var s = []byte("---") + for _, p := range ps { + switch p { + case Read: + s[0] = 'r' + case Write: + s[1] = 'w' + case Execute: + s[2] = 'x' + } + } + return string(s) +} func UpdatePerm(path string, uid int, perms ...Perm) error { // read acl from file -- cgit v1.3.1