Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: n4MemberGet n4nameConvert
If the group is _not_ in the default context, N4MemberGet returns FALSE, no matter what the membership status of the user is.
To make it work, you have to combine N4MemberGet() with N4NameConvert(). N4NameConvert allows you to specify a context for the group that you want to query. First you get your group information via something like "groupis=N4NameConvert()," and then you use it like this: "ismemberyn=N4MemberGet(groupis,"USERNAME")."
In order to query whether a user is a member of a group, you must first identify the group by its context, using n4NameConvert. You then need to pass that onto n4MemberGet.
In other words, the Netware 4 Group name needs to be specified in the NDS Canonical typeless form, i.e. Context.objectname. When checking the membership in a group this way, the n4MemberGet(group,name) function returns a valid result. Without it, the function always returns a positive result. To develop the correct name that the n4MemberGet function requires, use the n4NameConvert function, which provides the name in the correct form.
n4NameConvert(context, object, format) Parameters: (s) context a NetWare context, or "" for the current context. (s) object the name of a NetWare object. (i) format specifies what format "object" will be converted to.The 3 in the function below returns the Canonical format, e.g.Context.object which the n4GetUser uses.
;Set user and group names user="Widget" groupname="Win95" ; convert common group name to ndsGROUP=n4NameConvert("",groupname,3) ; CHECK FOR GROUP MEMBERSHIP. RETURNS 1 IF A MEMBER, 0 IF NOT isamembr=n4MemberGet(ndsGROUP,user)Note that in the n4NameConvert function, you must specify explicitly where the group is--it will not scan NDS groups. When you specify the default context (""), it assumes the group is in your default context--if it can't find the group in the default context, then it returns false. And if the group is in the default context, but the user is not a member, it also returns a false.
n4MemberGet can accept distinguished names. This is true of all the Netware 4 functions that take user or group names as parameters.
Article ID: W13622
Filename: n4MemberGet n4MemberSet.txt
File Created: 1999:05:28:10:21:40
Last Updated: 1999:05:28:10:21:40