add protected flag for some api methods

This commit is contained in:
Dietmar Maurer 2019-01-28 18:16:47 +01:00
parent a3da38ddfd
commit a859fa95a9
3 changed files with 26 additions and 18 deletions

View File

@ -242,37 +242,45 @@ pub fn router() -> Router {
.subdir(
"start",
Router::new()
.post(ApiMethod::new(
start_service,
ObjectSchema::new("Start service.")
.required("service", service_id_schema.clone()))
.post(
ApiMethod::new(
start_service,
ObjectSchema::new("Start service.")
.required("service", service_id_schema.clone())
).protected(true)
)
)
.subdir(
"stop",
Router::new()
.post(ApiMethod::new(
stop_service,
ObjectSchema::new("Stop service.")
.required("service", service_id_schema.clone()))
.post(
ApiMethod::new(
stop_service,
ObjectSchema::new("Stop service.")
.required("service", service_id_schema.clone())
).protected(true)
)
)
.subdir(
"restart",
Router::new()
.post(ApiMethod::new(
restart_service,
ObjectSchema::new("Restart service.")
.required("service", service_id_schema.clone()))
.post(
ApiMethod::new(
restart_service,
ObjectSchema::new("Restart service.")
.required("service", service_id_schema.clone())
).protected(true)
)
)
.subdir(
"reload",
Router::new()
.post(ApiMethod::new(
reload_service,
ObjectSchema::new("Reload service.")
.required("service", service_id_schema.clone()))
.post(
ApiMethod::new(
reload_service,
ObjectSchema::new("Reload service.")
.required("service", service_id_schema.clone())
).protected(true)
)
)
;

View File

@ -131,7 +131,7 @@ pub fn router() -> Router {
ObjectSchema::new("Returns a list of syslog entries.")
.required("n", IntegerSchema::new("Line number."))
.required("t", StringSchema::new("Line text."))
)
).protected(true)
);
route

View File

@ -83,7 +83,7 @@ pub fn router() -> Router {
set_timezone,
ObjectSchema::new("Set time zone.")
.required("timezone", StringSchema::new("Time zone. The file '/usr/share/zoneinfo/zone.tab' contains the list of valid names."))
)
).protected(true)
);