RLS DSL - v0.1.0
    Preparing search index...

    Function currentUser

    • Current user context helper

      Returns the current database user/role. Maps to current_user in PostgreSQL. This is different from auth.uid() - it returns the PostgreSQL role name, not the application user ID.

      Returns ContextValue

      A ContextValue representing the current database user

      // Role-based access (database roles)
      policy('admin_access')
      .on('sensitive_data')
      .read()
      .when(column('allowed_role').eq(currentUser()));

      // Check if current database user matches
      policy('role_check')
      .on('audit_log')
      .read()
      .when(call('is_role_member', [currentUser(), 'auditor']));