Allow grants the RC as allowed to load
()
| 98 | |
| 99 | // Allow grants the RC as allowed to load |
| 100 | func (rc *RC) Allow() (err error) { |
| 101 | if rc.allowPath == "" { |
| 102 | return fmt.Errorf("cannot allow empty path") |
| 103 | } |
| 104 | if err = os.MkdirAll(filepath.Dir(rc.allowPath), 0755); err != nil { |
| 105 | return |
| 106 | } |
| 107 | if err = allow(rc.path, rc.allowPath); err != nil { |
| 108 | return |
| 109 | } |
| 110 | if err = rc.times.Update(rc.allowPath); err != nil { |
| 111 | return |
| 112 | } |
| 113 | if _, err = os.Stat(rc.denyPath); err != nil { |
| 114 | if errors.Is(err, fs.ErrNotExist) { |
| 115 | return nil |
| 116 | } |
| 117 | return err |
| 118 | } |
| 119 | return os.Remove(rc.denyPath) |
| 120 | } |
| 121 | |
| 122 | // Deny revokes the permission of the RC file to load |
| 123 | func (rc *RC) Deny() (err error) { |
no test coverage detected