Apple AppleShare 3.0 Users and Groups Programming Interface User Manual
Page 12

66 ugGroups 168 bytes array of group IDs
(42 longs)
UGGetUserInfo can be used to provide information about a specific user,
enumerate all users in the file, or enumerate all users in a group.
In all three cases, the following information about the user is returned:
ugUserFlags, the user's settings; ugNumBadLogins, the number of failed login
attempts; ugPwdDate, the password creation date in seconds; ugNumGroups, the
number of groups the user belongs to; ugGroups (an array of 42 longwords),
the group IDs of the groups to which the user belongs; ugUserID; and
ugNamePtr (a pointer to a Str31).
If ugNumGroups is 1, then either the first or the second element in ugGroups
contains a group ID. The first element in the ugGroups field is reserved for
the primary group and contains the group ID if the user has a primary group;
otherwise it contains zero.
In the case of a specific user, the user is specified either by ugUserID or
by ugNamePtr. If ugUserID is used, then ugNamePtr should be a pointer to a
zero-length Str31. If ugNamePtr is used, then ugUserID should be 0. If both
fields have values, then ugUserID takes precedence. ugGroupID should always
be set to 0.
If ugPosOffset is 0, then the information passed back will be that of the
user specified. If ugPosOffset is 1, then the information passed back will be
that of the user following the one specified. If ugPosOffset is neither 0 nor
1, then the ugBadParamErr error will be returned.
To have UGGetUserInfo enumerate all the users, your program should
set ugGroupID, ugUserID, and ugPosOffset to 0, and ugNamePtr should be a
pointer to a zero-length Str31. When the function is called, the first user
record will be returned (if present). Then ugPosOffset should be set to 1 and
the function called repeatedly. Each time it is called, the function will
return information on the next user, until a ugNoMoreUsers or ugEOF error is
returned.
To have UGGetUserInfo enumerate all users in a group, your program should
set ugGroupID to the group ID, and ugUserID and ugPosOffset to 0; ugNamePtr
should be a pointer to a zero-length Str31. When the function is called, the
first user record within that group will be returned, if present. If
ugPosOffset is set to 1, the record of the user after ugUserID within that
group is returned. This process is repeated until a ugNoMoreUsers or ugEOF
error is returned.
If ugGroupID contains a group ID and a user is specified by ugUserID
or ugNamePtr, then the user has to be a member of that group. Otherwise,
a ugNotaMember error is returned.
Result Codes
noErr 0 No error.
ugULInfoRecNotCreated 3 There is a problem with the users and
groups file. Delete it and re-create it.