mirror of
https://github.com/restic/restic.git
synced 2026-11-06 15:29:21 +00:00
Introduce UserID, GroupID for snapshot
Use the fields UID and GID for Unix user and group ID, and the fields UserID and GroupID for Windows user and group strings.
This commit is contained in:
1 parent
d1fee28ae5
commit
bb777d9a58
4 files changed
+77
-16
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package restic
|
||||
|
||||
import (
|
||||
"os/user"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func (sn *Snapshot) fillUserInfo() error {
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sn.Username = usr.Username
|
||||
uid, err := strconv.ParseInt(usr.Uid, 10, 32)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sn.UID = uint32(uid)
|
||||
|
||||
gid, err := strconv.ParseInt(usr.Gid, 10, 32)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sn.GID = uint32(gid)
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user