fix: correct the operator lock, app source error and admin intro texts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Guilhem Lemouel
2026-11-10 05:40:39 -08:00
co-authored by Claude Opus 5.5
parent c422f3d8dc
commit 373f02f0ce
3 changed files with 20 additions and 5 deletions
+7 -1
View File
@@ -546,7 +546,13 @@ async fn manage_denied(db: &DB, w_id: &str, authed: &ApiAuthed) -> Vec<(ManageKi
if !authed.is_admin {
for kind in [ManageKind::Schedules, ManageKind::Triggers] {
if let Err(e) = check_operator_can_manage(db, w_id, authed, kind).await {
denied.push((kind, e.to_string()));
// Shown as a lock text, a plain sentence like the path rules' texts, so without
// the "Permission denied: " prefix the error's display adds.
let reason = match e {
Error::PermissionDenied(reason) => reason,
e => e.to_string(),
};
denied.push((kind, reason));
}
}
}
@@ -546,8 +546,17 @@ fn app_runs_as(policy: Option<&Value>) -> RunsAs {
}
fn root_from_source(kind: RootKind, item: &str, source: ReadsSource) -> Result<(Node, RunsAs)> {
let missing =
|field: &str| Error::BadRequest(format!("the source of a {} needs {field}", kind.as_str()));
let article = if matches!(kind, RootKind::App) {
"an"
} else {
"a"
};
let missing = |field: &str| {
Error::BadRequest(format!(
"the source of {article} {} needs {field}",
kind.as_str()
))
};
Ok(match kind {
RootKind::Script => {
let content = source.content.ok_or_else(|| missing("content"))?;
@@ -321,8 +321,8 @@
What members of g/{name} can read through this group alone, and which grant gives each item.
Members may reach more through their own grants and other groups.
{:else}
What {principal} can read, and which grant gives each item. Jobs that run as
{principal} read exactly this set.
What {principal} can read, and which grant gives each item.
{#if access && !access.is_admin}Jobs that run as {principal} read exactly this set.{/if}
{/if}
</p>