Documentation ¶
Index ¶
- Variables
- func CheckFileOwnerRights(filePath, requiredOwner string) error
- func CheckFileRights(filePath string) error
- func FileHasPermission(filePath string, permission FilePermission) (bool, error)
- func GetFileGroupName(filePath string) (string, error)
- func GetFileOwnerUserName(filePath string) (string, error)
- func GetFileStatPermission(filePath string) (uint32, error)
- type FilePermission
Constants ¶
This section is empty.
Variables ¶
View Source
var FilePermissionInHex = map[FilePermission]uint32{ OwnerWrite: unix.S_IWUSR, GroupWrite: unix.S_IWGRP, AnyoneWrite: unix.S_IWOTH, OwnerRead: unix.S_IRUSR, AnyoneRead: unix.S_IROTH, }
Functions ¶
func CheckFileOwnerRights ¶
CheckFileOwnerRights check that the given owner is the same owner of the given filepath
func CheckFileRights ¶
CheckFileRights check that the given file path has been protected by the owner. If the owner is changed, they need at least the sudo permission to override the owner.
func FileHasPermission ¶
func FileHasPermission(filePath string, permission FilePermission) (bool, error)
func GetFileGroupName ¶
func GetFileOwnerUserName ¶
func GetFileStatPermission ¶
Types ¶
type FilePermission ¶
type FilePermission string
const ( OwnerWrite FilePermission = "OwnerWrite" GroupWrite FilePermission = "GroupWrite" AnyoneWrite FilePermission = "AnyoneWrite" OwnerRead FilePermission = "OwnerRead" AnyoneRead FilePermission = "AnyoneRead" )
Click to show internal directories.
Click to hide internal directories.