unix-2.7.2.1: POSIX functionality

Copyright(c) The University of Glasgow 2002
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilityprovisional
Portabilitynon-portable (requires POSIX)
Safe HaskellTrustworthy
LanguageHaskell2010

System.Posix.User

Contents

Description

POSIX user/group support

Synopsis

User environment

Querying the user environment

getRealUserID :: IO UserID Source #

getRealUserID calls getuid to obtain the real UserID associated with the current process.

getRealGroupID :: IO GroupID Source #

getRealGroupID calls getgid to obtain the real GroupID associated with the current process.

getEffectiveUserID :: IO UserID Source #

getEffectiveUserID calls geteuid to obtain the effective UserID associated with the current process.

getEffectiveGroupID :: IO GroupID Source #

getEffectiveGroupID calls getegid to obtain the effective GroupID associated with the current process.

getGroups :: IO [GroupID] Source #

getGroups calls getgroups to obtain the list of supplementary GroupIDs associated with the current process.

getLoginName :: IO String Source #

getLoginName calls getlogin to obtain the login name associated with the current process.

getEffectiveUserName :: IO String Source #

getEffectiveUserName gets the name associated with the effective UserID of the process.

The group database

data GroupEntry Source #

Constructors

GroupEntry 

Fields

getGroupEntryForID :: GroupID -> IO GroupEntry Source #

getGroupEntryForID gid calls getgrgid_r to obtain the GroupEntry information associated with GroupID gid. This operation may fail with isDoesNotExistError if no such group exists.

getGroupEntryForName :: String -> IO GroupEntry Source #

getGroupEntryForName name calls getgrnam_r to obtain the GroupEntry information associated with the group called name. This operation may fail with isDoesNotExistError if no such group exists.

getAllGroupEntries :: IO [GroupEntry] Source #

getAllGroupEntries returns all group entries on the system by repeatedly calling getgrent

The user database

data UserEntry Source #

Constructors

UserEntry 

Fields

getUserEntryForID :: UserID -> IO UserEntry Source #

getUserEntryForID gid calls getpwuid_r to obtain the UserEntry information associated with UserID uid. This operation may fail with isDoesNotExistError if no such user exists.

getUserEntryForName :: String -> IO UserEntry Source #

getUserEntryForName name calls getpwnam_r to obtain the UserEntry information associated with the user login name. This operation may fail with isDoesNotExistError if no such user exists.

getAllUserEntries :: IO [UserEntry] Source #

getAllUserEntries returns all user entries on the system by repeatedly calling getpwent

Modifying the user environment

setUserID :: UserID -> IO () Source #

setUserID uid calls setuid to set the real, effective, and saved set-user-id associated with the current process to uid.

setGroupID :: GroupID -> IO () Source #

setGroupID gid calls setgid to set the real, effective, and saved set-group-id associated with the current process to gid.

setEffectiveUserID :: UserID -> IO () Source #

setEffectiveUserID uid calls seteuid to set the effective user-id associated with the current process to uid. This does not update the real user-id or set-user-id.

setEffectiveGroupID :: GroupID -> IO () Source #

setEffectiveGroupID uid calls setegid to set the effective group-id associated with the current process to gid. This does not update the real group-id or set-group-id.

setGroups :: [GroupID] -> IO () Source #

setGroups calls setgroups to set the list of supplementary GroupIDs associated with the current process.