| Haskell Hierarchical Libraries (unix package) | Contents | Index

System.Posix.User

Portability | non-portable (requires POSIX)
Stability | provisional
Maintainer | libraries@haskell.org

Contents

User environment
  Querying the user environment
    The group database
    The user database
  Modifying the user environment

Description
POSIX user/group support
Synopsis

getRealUserID :: IO UserID
getRealGroupID :: IO GroupID
getEffectiveUserID :: IO UserID
getEffectiveGroupID :: IO GroupID
getGroups :: IO [GroupID]
getLoginName :: IO String
getEffectiveUserName :: IO String

data GroupEntry = GroupEntry {

groupName :: String
groupID :: GroupID
groupMembers :: [String]

}

getGroupEntryForID :: GroupID -> IO GroupEntry
getGroupEntryForName :: String -> IO GroupEntry

data UserEntry = UserEntry {

userName :: String
userID :: UserID
userGroupID :: GroupID
homeDirectory :: String
userShell :: String

}

getUserEntryForID :: UserID -> IO UserEntry
getUserEntryForName :: String -> IO UserEntry
setUserID :: UserID -> IO ()
setGroupID :: GroupID -> IO ()

User environment
Querying the user environment
getRealUserID :: IO UserID
`getRealUserID` calls `getuid` to obtain the real `UserID` associated with the current process.
getRealGroupID :: IO GroupID
`getRealGroupID` calls `getgid` to obtain the real `GroupID` associated with the current process.
getEffectiveUserID :: IO UserID
`getEffectiveUserID` calls `geteuid` to obtain the effective `UserID` associated with the current process.
getEffectiveGroupID :: IO GroupID
`getEffectiveGroupID` calls `getegid` to obtain the effective `GroupID` associated with the current process.
getGroups :: IO [GroupID]
`getGroups` calls `getgroups` to obtain the list of supplementary `GroupID`s associated with the current process.
getLoginName :: IO String
`getLoginName` calls `getlogin` to obtain the login name associated with the current process.
getEffectiveUserName :: IO String
`getEffectiveUserName` gets the name associated with the effective `UserID` of the process.
The group database
data GroupEntry

Constructors

GroupEntry |

groupName :: String |
groupID :: GroupID |
groupMembers :: [String] |

getGroupEntryForID :: GroupID -> IO GroupEntry
`getGroupEntryForID gid` calls `getgrgid` to obtain the `GroupEntry` information associated with `GroupID` `gid`.
getGroupEntryForName :: String -> IO GroupEntry
`getGroupEntryForName name` calls `getgrnam` to obtain the `GroupEntry` information associated with the group called `name`.
The user database
data UserEntry

Constructors

UserEntry |

userName :: String |
userID :: UserID |
userGroupID :: GroupID |
homeDirectory :: String |
userShell :: String |

getUserEntryForID :: UserID -> IO UserEntry
`getUserEntryForID gid` calls `getpwuid` to obtain the `UserEntry` information associated with `UserID` `uid`.
getUserEntryForName :: String -> IO UserEntry
`getUserEntryForName name` calls `getpwnam` to obtain the `UserEntry` information associated with the user login `name`.
Modifying the user environment
setUserID :: UserID -> IO ()
`setUserID uid` calls `setuid` to set the real, effective, and saved set-user-id associated with the current process to `uid`.
setGroupID :: GroupID -> IO ()
`setGroupID gid` calls `setgid` to set the real, effective, and saved set-group-id associated with the current process to `gid`.
Produced by Haddock version 0.7