acl.GetEntry problem/question

I have an agent that runs perfectly in my template, but won’t work in the production database. The place in the code that fails is

Set entry = acl.GetEntry([a user name goes here])

Stepping through with the debugger reveals “entry” coming back null. Again, it works fine in the template, however the template ACL has the username entered explicitly and in the production database the username(s) are in a group.

I’m simply trying to determine through LotusScript if a given user is a member of an ACL group that is assigned to a particular role.

Any suggestions are appreciated.

Subject: acl.GetEntry problem/question

Chances are that in your template the individual is explicitly named in the ACL, thus they have an ACL Entry.

In your production db they are a member of a group and thus don’t actually have an ACL Entry of their own.

If you just want to determine if a user has a particular role you can use evaluate( “@userroles” ) like this:

’ determine if a user has a particular role. Role name should include

’ the eg [admin]

Function hasRole( roleName as String ) As Boolean

dim session as new NotesSession()

Dim userroles As Variant

userroles = Evaluate(“@UserRoles”)

Forall role In userroles

If ( role = roleName ) Then

  hasRole = True

  Exit Function

End If

End Forall

hasRole = False

End Function

For example:

if ( hasRole( “[admin]” ) ) then

’ … do something here

end if

Frunobulax

Subject: RE: acl.GetEntry problem/question

That looks like it will do what I need. I’ll try it and post the result. Thanks a million.

Subject: RE: acl.GetEntry problem/question

It worked perfectly for me. Many thanks Mr. Frunobulax.

Subject: acl.GetEntry problem/question

Jeffery,

If the users are a member of a group, I do not believe the acl.GetEntry will list them, but instead will list the group itself.

What you would probably have to do is create view.GetDocumentByKey against the ($MailGroups) view in names.nsf and find the group doc. Then you’ll have to loop through the values in Members field to find your person.

I’ve verified it by checking the Notes help:

GetEntry can find people, groups, or servers in an ACL. If a person is not listed explicitly in the ACL, but is a member of a group that’s listed in the ACL, GetEntry does not find that person’s name.

hth.

brandt