Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: a3cc6d81efacad61e24a7b962987a9ecae711c56 authored by Martin v. Löwis on 21 February 2008, 11:54:20 UTC
Redo tag.
Tip revision: a3cc6d8
libgrp.tex
\section{\module{grp} ---
         The group database}

\declaremodule{builtin}{grp}
  \platform{Unix}
\modulesynopsis{The group database (\function{getgrnam()} and friends).}


This module provides access to the \UNIX{} group database.
It is available on all \UNIX{} versions.

Group database entries are reported as a tuple-like object, whose
attributes correspond to the members of the \code{group} structure
(Attribute field below, see \code{<pwd.h>}):

\begin{tableiii}{r|l|l}{textrm}{Index}{Attribute}{Meaning}
  \lineiii{0}{gr_name}{the name of the group}
  \lineiii{1}{gr_passwd}{the (encrypted) group password; often empty}
  \lineiii{2}{gr_gid}{the numerical group ID}
  \lineiii{3}{gr_mem}{all the group member's  user  names}
\end{tableiii}

The gid is an integer, name and password are strings, and the member
list is a list of strings.
(Note that most users are not explicitly listed as members of the
group they are in according to the password database.  Check both
databases to get complete membership information.)

It defines the following items:

\begin{funcdesc}{getgrgid}{gid}
Return the group database entry for the given numeric group ID.
\exception{KeyError} is raised if the entry asked for cannot be found.
\end{funcdesc}

\begin{funcdesc}{getgrnam}{name}
Return the group database entry for the given group name.
\exception{KeyError} is raised if the entry asked for cannot be found.
\end{funcdesc}

\begin{funcdesc}{getgrall}{}
Return a list of all available group entries, in arbitrary order.
\end{funcdesc}


\begin{seealso}
  \seemodule{pwd}{An interface to the user database, similar to this.}
  \seemodule{spwd}{An interface to the shadow password database, similar to this.}
\end{seealso}
back to top