pub(crate) fn apply_rules(
state: &AppState,
def: &mut JobDefinition,
before: Option<&JobDefinition>,
origin: Origin,
) -> Result<Vec<String>, (StatusCode, Json<Value>)>Expand description
Apply what the caps ask of a job’s author to def, before it is stored:
- an agent’s higher caps are clamped to the defaults (the operator’s, via the host, are kept);
- a job on a provider that reports no cost needs the operator’s confirmation, unless it is the same agent as before, and gets a timeout when it names none.
before is the job’s definition on an edit. Returns the sentences the
reply should carry.