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( .subdir(
"start", "start",
Router::new() Router::new()
.post(ApiMethod::new( .post(
ApiMethod::new(
start_service, start_service,
ObjectSchema::new("Start service.") ObjectSchema::new("Start service.")
.required("service", service_id_schema.clone())) .required("service", service_id_schema.clone())
).protected(true)
) )
) )
.subdir( .subdir(
"stop", "stop",
Router::new() Router::new()
.post(ApiMethod::new( .post(
ApiMethod::new(
stop_service, stop_service,
ObjectSchema::new("Stop service.") ObjectSchema::new("Stop service.")
.required("service", service_id_schema.clone())) .required("service", service_id_schema.clone())
).protected(true)
) )
) )
.subdir( .subdir(
"restart", "restart",
Router::new() Router::new()
.post(ApiMethod::new( .post(
ApiMethod::new(
restart_service, restart_service,
ObjectSchema::new("Restart service.") ObjectSchema::new("Restart service.")
.required("service", service_id_schema.clone())) .required("service", service_id_schema.clone())
).protected(true)
) )
) )
.subdir( .subdir(
"reload", "reload",
Router::new() Router::new()
.post(ApiMethod::new( .post(
ApiMethod::new(
reload_service, reload_service,
ObjectSchema::new("Reload service.") ObjectSchema::new("Reload service.")
.required("service", service_id_schema.clone())) .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.") ObjectSchema::new("Returns a list of syslog entries.")
.required("n", IntegerSchema::new("Line number.")) .required("n", IntegerSchema::new("Line number."))
.required("t", StringSchema::new("Line text.")) .required("t", StringSchema::new("Line text."))
) ).protected(true)
); );
route route

View File

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