\documentclass{article}

\usepackage[docdef=restricted]{glossaries-extra}

\makeglossaries

\begin{document}
\newglossaryentry{sample}{name={sample},
 description={an example}}

A \gls{sample} document.

\printglossaries

\end{document}
