WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Groups

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

N4MemberGet Always Returning 40
for Member in Group

Keywords: n4MemberGet n4nameConvert 

Question:

In WinBatch version 96K, n4MemberGet is always returning a 40, whether or not a user is a member of a specified group.

Answer:

N4MemberGet() by itself only looks at the current context. If the group is in the default context and the user is a member of the group, it returns TRUE. If the user is _not_ a member of the group, it returns FALSE.

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.

Question:

How do I change permissions of members of users in a group?

Answer:

First set up the Novell group, and then change the permissions of members in that group with the n4MemberSet function.

n4MemberDel function bug:

There are reports that n4MemberDel was deleting all users in a group in some systems. This bug was fixed in Winbatch version 98B.

Question:

I am attempting to check if a user is a member of 'the world' group in Windows NT. If I specify "the world" for the group parameter in n4MemberGet, I get the error "bad user name"......

Answer:

There's no actual group called "The World"; it's a virtual group that represents all users. To achieve the same effect, use an asterisk ('*') as the group name.
Article ID:   W13622
Filename:   n4MemberGet n4MemberSet.txt
File Created: 1999:05:28:10:21:40
Last Updated: 1999:05:28:10:21:40