Question:
How can I retrieve, via scripts, both user name and user group to which this user belongs?
Solution:
Username is retrieved by Viewer‘s User property.
Example:
dim user
user = Application.User
msgbox “Logged user: ” & user
user = Application.User
msgbox “Logged user: ” & user
To confirm the name of the group to which the user belongs, you will need to use Viewer‘s IsUserMemberOfGroup(GroupName) method. GroupName parameter must indicate the name of the group to which you want to consult.
Example (script checking whether user belongs to Admin group):
if Application.IsUserMemberOfGroup(“Admin”) then
msgbox “This user is an administrator.”
end if
msgbox “This user is an administrator.”
end if