Authorize enabling insecure mode with PolicyKit on Linux

This commit is contained in:
世界
2026-09-08 23:05:12 +08:00
parent 046c46eacb
commit 6d1fc214c1
6 changed files with 60 additions and 56 deletions
@@ -1,24 +0,0 @@
//go:build linux
package main
import (
"os"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func authorizeDisableInsecureMode(identity peerIdentity) error {
ownerUserID, err := loadOwner()
if err != nil {
if os.IsNotExist(err) {
return status.Error(codes.PermissionDenied, "the service has no owner")
}
return err
}
if ownerUserID != identity.UserID {
return status.Error(codes.PermissionDenied, "the service is owned by another user")
}
return nil
}