You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

19 lines
518 B

package api
import (
"context"
"net/http"
"tera-clone/services/tera-api/internal/domain"
)
func (r *Router) authorizePortLogSettings(w http.ResponseWriter, ctx context.Context, update domain.PortUpdate) bool {
if update.DataLog == nil && update.DataLogMode == nil {
return true
}
actor, ok := domain.ActorFromContext(ctx)
if !ok || actor.Role != "administrator" {
writeError(w, http.StatusForbidden, "authorization_denied", "port log settings require administrator role")
return false
}
return true
}