web synchronized with the new changes
This commit is contained in:
@@ -26,7 +26,7 @@ pub(crate) async fn load_page(
|
||||
_ => LoadError::Backend(error.message().to_string()),
|
||||
})?
|
||||
.into_inner();
|
||||
if authorization.role != "admin" {
|
||||
if !crate::authz::can_manage(&authorization, crate::authz::STRUCT_SCRIPT) {
|
||||
return Err(LoadError::Forbidden);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ pub(crate) async fn load_page(
|
||||
})
|
||||
.collect();
|
||||
Ok(AddLogicPageState {
|
||||
nav: crate::ui::Nav::new(headers, "admin").with_role(authorization.role),
|
||||
nav: crate::ui::Nav::new(headers, "admin").with_authorization(&authorization),
|
||||
tables,
|
||||
form,
|
||||
error,
|
||||
|
||||
@@ -66,7 +66,7 @@ fn render_loaded(result: Result<super::state::AddLogicPageState, LoadError>) ->
|
||||
Err(LoadError::Unauthenticated) => Redirect::to("/login").into_response(),
|
||||
Err(LoadError::Forbidden) => (
|
||||
StatusCode::FORBIDDEN,
|
||||
Html(ui::render_submission_error("Administrator access is required.")),
|
||||
Html(ui::render_submission_error("Script-management permission is required.")),
|
||||
)
|
||||
.into_response(),
|
||||
Err(LoadError::Backend(message)) => (
|
||||
|
||||
Reference in New Issue
Block a user