if_uid

Function if_uid 

Source
pub fn if_uid<'reg, 'rc>(
    h: &Helper<'reg, 'rc>,
    r: &'reg Handlebars<'reg>,
    ctx: &'rc Context,
    rc: &mut RenderContext<'reg, 'rc>,
    out: &mut dyn Output,
) -> HelperResult
Expand description

A templating helper that tests if current user’s effective uid matches a set of given integer(s).

Usage:

  1. {{#if_uid "1000,1001"}}..foo..{{/if_uid}}

    Renders ..foo.. only if current user’s effective uid is either 1000 or 1001.

  2. {{#if_uid 0}}..foo..{{else}}..bar..{{/if_uid}}

    Renders ..foo.. only if current user’s effective uid is 0, renders ..bar.. only if current user’s effective uid is not 0.

  3. {{#if_uid some.array}}..foo..{{/if_uid}}

    Renders ..foo.. only if current user’s effective uid is exactly one of the values from the templating variable some.array (defined in the config file’s [[context]] section).

[[context]]: dt_core::config::ContextConfig