#!/bin/bash

checkRootRequirement()
{
	if [[ $CFG_REQUIREMENT_ROOT == "true" ]]; then
		# Model A least-privilege: the app runs AS the manager user and escalates
		# only specific commands via runSystem, so accept the manager as well as
		# root — not root-only. (init.sh keeps its own install-time root check.)
		local mgr="${sudo_user_name:-libreportal}"
		if [[ $EUID -eq 0 || "$(id -un)" == "$mgr" ]]; then
			isSuccessful "Running as $(id -un)."
		else
			echo "This script must be run as root or the manager user ($mgr)."
			exit 1
		fi
	fi
}