Skip to main content

get_access_level

Function get_access_level 

Source
pub async fn get_access_level(
    app: &App,
    tn_id: TnId,
    file_id: &str,
    owner_id_tag: &str,
    ctx: &FileAccessCtx<'_>,
    inherited_share: Option<AccessLevel>,
) -> AccessLevel
Expand description

Get access level for a user on a file

Determines access level based on:

  1. Ownership — owner has Admin access
  2. Direct share_entries grant on this file, then the caller-supplied inherited_share, then a parent-chain walk for a folder-inherited grant
  3. Role-based access — tenant-owned files only: leader → Admin, moderator/contributor → Write, any role → Read
  4. FSHR action issued by the file’s owner — ADMIN → Admin, WRITE → Write, COMMENT → Comment, DEL → None (a revocation is not a grant), other sub-types → Read (see [fshr_grant_level])
  5. No access — returns None