Simple LS question

just a quick and easy question…Which is the code that I have to write in the QuerySave event,

to prevent users not belonging to the “ProductAdministrator” role, to save the document?

That is, how do I see if the current user belongs to the “ProductAdministrator” role?

thanks

Subject: simple LS question

Try this;

Dim varIsMember As Variant

varIsMember = Evaluate({@IsMember(“[ProductAdministrator]” ; @UserRoles})

If varIsMember(0) = “1” Then

 Exit Sub

End If

Subject: RE: simple LS question

Hi

for both solutions…

continue=false

could help.

ian

Subject: simple LS question

Pablo, you could also incorporate the below function into your application, perhaps in a script library and Use it, or directly in your form.

Once you do that, then in your QuerySave event, just do something like this:

If Not HasRole(“[ProductAdministrator]”) then

MsgBox “You are not authorized to save this document”)

Exit Sub

End If

Function HasRole (Role As String) As Integer

allroles = Evaluate(“@UserRoles”)

'Get the roles for the user and if user has the particular role

FoundRole% = False

Forall r In allroles

If r = Role Then

FoundRole% = True

End If

End Forall

HasRole = FoundRole%

End Function