/
wax_boy
/
semaphore_custom
Обзор
Документация
Войти
/
wax_boy
/
semaphore_custom
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
api/cache.go
32 строки
695 B
Denis Gukov
sec/golangci (#3817)
02 май 2026, 16:52
Не верифицирован
02 май 2026, 16:52
71e2baf
Код
Авторство
О чём код?
package api import ( "net/http" "github.com/semaphoreui/semaphore/api/helpers" "github.com/semaphoreui/semaphore/db" "github.com/semaphoreui/semaphore/util" log "github.com/sirupsen/logrus" ) func clearCache(w http.ResponseWriter, r *http.Request) { currentUser := helpers.GetFromContext(r, "user").(*db.User) if !currentUser.Admin { helpers.WriteJSON(w, http.StatusForbidden, map[string]string{ "error": "User must be admin", }) return } err := util.Config.ClearTmpDir() if err != nil { log.Error(err) helpers.WriteJSON(w, http.StatusInternalServerError, map[string]string{ "error": "Can not clear cache", }) return } w.WriteHeader(http.StatusNoContent) }