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

When UGGetGroupInfo is used to get information about a specific group, the
group is specified either by ugGroupID or by ugNamePtr. If ugGroupID is used,
then ugNamePtr should be a pointer to a zero-length Str31. If ugNamePtr is
used, then ugGroupID should be 0. If both fields have values, then ugGroupID
takes precedence. If ugPosOffset is 0, then the information passed back will
be that of the group specified. If ugPosOffset is 1, then the information
passed back will be that of the group following the one specified. If
ugPosOffset is neither 0 nor 1, then a ugBadParamErr error will be returned.
To have UGGetGroupInfo enumerate all groups in the users and groups file,
your program should set ugGroupID and ugPosOffset to 0, and ugNamePtr should
be a pointer to a zero-length Str31. When the function is called, the first
group record will be returned, if present. If ugPosOffset is set to 1, the
information of the group after ugGroupID is returned. This process is
repeated until a ugNoMoreGroups or ugEOF error is returned.
Result Codes
noErr 0 No error.
ugGroupNotFound 6 The group is not in the users and
groups file.
ugNotAGroup 8 ugGroupID is not the ID of a group.
ugNoMoreGroups 12 No more groups exist in the users and
groups file.
ugBadParamErr 13 async is TRUE, or ugPosOffset is
neither 0 nor 1.
ugEOF 23 End of file.
ugFatalError 99 There is a problem with the users and
groups file. Delete and re-create it
UGAssignUserToGroup
FUNCTION UGAssignUserToGroup (thePB: UserGroupPBPtr; async: BOOLEAN): OSErr;
pascal OSErr UGAssignUserToGroup (UserGroupPBPtr thePB, Boolean async);
Parameter Block 24 ugRefNum word file reference
number
30 ugAccessID long program access
ID
34 ugUserID long user ID
38 ugGroupID long group ID
48 ugPrimaryFlag Boolean primary group flag
UGAssignUserToGroup allows your program to add a user to a group. The user is
specified in ugUserID and the group is specified in ugGroupID. If
ugPrimaryFlag is TRUE, then the group specified becomes the user's primary