Fix required API methods

This commit is contained in:
Daniel
2021-05-11 14:56:39 +02:00
parent c3812f1c56
commit 660c1bf3c5
4 changed files with 6 additions and 6 deletions

View File

@@ -26,7 +26,7 @@ func registerEvents() {
func registerAPIEndpoints() error {
if err := api.RegisterEndpoint(api.Endpoint{
Path: "core/shutdown",
Read: api.PermitSelf,
Write: api.PermitSelf,
ActionFunc: shutdown,
}); err != nil {
return err
@@ -34,7 +34,7 @@ func registerAPIEndpoints() error {
if err := api.RegisterEndpoint(api.Endpoint{
Path: "core/restart",
Read: api.PermitAdmin,
Write: api.PermitAdmin,
ActionFunc: restart,
}); err != nil {
return err

View File

@@ -10,7 +10,7 @@ import (
func registerAPI() error {
if err := api.RegisterEndpoint(api.Endpoint{
Path: "dns/clear",
Read: api.PermitUser,
Write: api.PermitUser,
ActionFunc: clearNameCache,
Name: "Clear cached DNS records",
Description: "Deletes all saved DNS records from the database.",

View File

@@ -9,7 +9,7 @@ import (
func registerAPIEndpoints() error {
return api.RegisterEndpoint(api.Endpoint{
Path: "ui/reload",
Read: api.PermitUser,
Write: api.PermitUser,
ActionFunc: reloadUI,
})
}

View File

@@ -10,8 +10,8 @@ const (
func registerAPIEndpoints() error {
return api.RegisterEndpoint(api.Endpoint{
Path: apiPathCheckForUpdates,
Read: api.PermitUser,
Path: apiPathCheckForUpdates,
Write: api.PermitUser,
ActionFunc: func(_ *api.Request) (msg string, err error) {
if err := TriggerUpdate(); err != nil {
return "", err