|
|
@@ -27,12 +27,14 @@ func (mch *Handler) ReadAllWhitelists() Whitelist {
|
|
|
|
|
|
//WriteWhitelist is exported function
|
|
|
func (mch *Handler) WriteWhitelist(UUID string, Name string) bool {
|
|
|
+ mch.ReadAllWhitelists()
|
|
|
newItem := Whitelist{}
|
|
|
newItem = append(newItem, struct {
|
|
|
UUID string `json:"uuid"`
|
|
|
Name string `json:"name"`
|
|
|
}{UUID, Name})
|
|
|
mch.whitelists = append(mch.whitelists, newItem...)
|
|
|
+ mch.SaveAllWhitelists()
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
@@ -58,6 +60,7 @@ func (mch *Handler) ReadWhitelist(search string, field string) Whitelist {
|
|
|
|
|
|
//RemoveWhitelist is exported function
|
|
|
func (mch *Handler) RemoveWhitelist(search string, field string) bool {
|
|
|
+ mch.ReadAllWhitelists()
|
|
|
for i, item := range mch.whitelists {
|
|
|
fieldValue := ""
|
|
|
switch strings.ToLower(field) {
|
|
|
@@ -77,6 +80,7 @@ func (mch *Handler) RemoveWhitelist(search string, field string) bool {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ mch.SaveAllWhitelists()
|
|
|
return true
|
|
|
}
|
|
|
|