forked from goftp/server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
perm.go
48 lines (37 loc) · 875 Bytes
/
perm.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package server
import "os"
type Perm interface {
GetOwner(string) (string, error)
GetGroup(string) (string, error)
GetMode(string) (os.FileMode, error)
ChOwner(string, string) error
ChGroup(string, string) error
ChMode(string, os.FileMode) error
}
type SimplePerm struct {
owner, group string
}
func NewSimplePerm(owner, group string) *SimplePerm {
return &SimplePerm{
owner: owner,
group: group,
}
}
func (s *SimplePerm) GetOwner(string) (string, error) {
return s.owner, nil
}
func (s *SimplePerm) GetGroup(string) (string, error) {
return s.group, nil
}
func (s *SimplePerm) GetMode(string) (os.FileMode, error) {
return os.ModePerm, nil
}
func (s *SimplePerm) ChOwner(string, string) error {
return nil
}
func (s *SimplePerm) ChGroup(string, string) error {
return nil
}
func (s *SimplePerm) ChMode(string, os.FileMode) error {
return nil
}