Skip to content

Commit 0884c53

Browse files
committed
fix: resolve clippy doc-markdown and collapsible-if lints
- Backtick `PermissionDenied` in doc comments - Collapse nested if-let + if into single let-chain Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Paolo Dettori <dettori@us.ibm.com>
1 parent b47a876 commit 0884c53

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

crates/openshell-server/src/auth/ownership.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ pub fn scoped_name_for_principal(
224224
/// Resolution order:
225225
/// 1. Try `{owner}/{name}` (user's own provider) — non-admin only
226226
/// 2. Fall back to `{name}` (shared/legacy provider, no owner prefix)
227-
/// - If found and owned by another user: PermissionDenied (non-admin)
227+
/// - If found and owned by another user: `PermissionDenied` (non-admin)
228228
/// 3. Suffix scan for `*/{name}` (cross-user detection)
229229
/// - If found and admin: return the match
230-
/// - If found and non-admin: PermissionDenied
230+
/// - If found and non-admin: `PermissionDenied`
231231
///
232232
/// Admin callers with explicit scoped name (contains '/') resolve directly.
233233
/// Anonymous principals resolve the raw name directly (backward compat).
@@ -279,12 +279,13 @@ pub async fn resolve_scoped_name(
279279
if let Some(ref labels_json) = record.labels {
280280
let labels: HashMap<String, String> =
281281
serde_json::from_str(labels_json).unwrap_or_default();
282-
if let Some(record_owner) = labels.get(OWNER_LABEL) {
283-
if *record_owner != caller_owner && !is_admin {
284-
return Err(Status::permission_denied(
285-
"provider is owned by another user",
286-
));
287-
}
282+
if let Some(record_owner) = labels.get(OWNER_LABEL)
283+
&& *record_owner != caller_owner
284+
&& !is_admin
285+
{
286+
return Err(Status::permission_denied(
287+
"provider is owned by another user",
288+
));
288289
}
289290
}
290291
return Ok(shared);

0 commit comments

Comments
 (0)