Test privileges early and complain if privileges are insufficient.
The patch is based on ideas presented in the PR, but implemented
differently. Re-open the PR, if this solution has unexpected side-effects
or proves insufficient.
PR: 174729
Reported by: ngie
Approved by: antoine (implicit)