-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from patrickhener/filebased-access
Implement ACLs as request by Issue #43
- Loading branch information
Showing
10 changed files
with
183 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package httpserver | ||
|
||
import ( | ||
"encoding/json" | ||
"io" | ||
"io/fs" | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
func (fs *FileServer) findSpecialFile(fis []fs.FileInfo, file *os.File) (configFile, error) { | ||
var config configFile | ||
|
||
for _, fi := range fis { | ||
if fi.Name() == ".goshs" { | ||
openFile := filepath.Join(file.Name(), fi.Name()) | ||
|
||
configFileDisk, err := os.Open(openFile) | ||
if err != nil { | ||
return config, err | ||
} | ||
|
||
configFileBytes, err := io.ReadAll(configFileDisk) | ||
if err != nil { | ||
return config, err | ||
} | ||
|
||
if err := json.Unmarshal(configFileBytes, &config); err != nil { | ||
return config, err | ||
} | ||
|
||
return config, nil | ||
} | ||
} | ||
|
||
return config, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package httpserver | ||
|
||
func removeItem(sSlice []item, item string) []item { | ||
index := 0 | ||
|
||
for idx, sliceItem := range sSlice { | ||
if item == sliceItem.Name { | ||
index = idx | ||
} | ||
} | ||
|
||
return append(sSlice[:index], sSlice[index+1:]...) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters