Security functions

Use the security functions to get the name of the current user, and to check whether the current user or computer has been assigned to a particular security code or group.
The following table lists security functions:
This function
Returns this value
CurrentComputerHasGroup
(
GroupName
)
1
(True) if the current computer is assigned to the specified group.
The argument can be a literal string, string tag, or tag placeholder. If you use a string, it must be enclosed in double quotes, for example, CurrentComputerHasGroup("
GroupName1
").
The argument can also be a combination of a literal string and string tag in the format of “
Liter string
” +
String tag
, for example, CurrentComputerHasGroup("
GroupName1
"+{
[Controller]Main.GroupName
}).
When using the function, note that:
  • The function only works in the Network Station or Network Distributed application. It always returns 1 (True) if you use it in a Local Station application.
  • In the FactoryTalk security policies, if you use the names of the terminal client to identify terminal server clients, make sure to add the terminal client account to the FactoryTalk network directory. Otherwise, it cannot get the current terminal client computer name and will return errors. For more information about FactoryTalk security policies, see FactoryTalk Help.
CurrentUserHasCode
(
SecurityCode
)
1
(True) if the current user has the specified security code. The security code is a letter from A through P.
The argument can be a security code, tag name, or tag placeholder. If you use a tag name or tag placeholder, it must be enclosed in curly brackets ({}), for example, CurrentUserHasCode({#1}).
If checking multiple security codes, do not type a space between the security code letters, for example, CurrentUserHasCode(ABP).
CurrentUserHasGroup
(
UserGroupName
)
1
(True) if the current user is assigned to the specified group.
The argument can be a literal string, string tag, or tag placeholder. If you use a string, it must be enclosed in double quotes, for example, CurrentUserHasGroup ("
UserGroupName1
").
The argument can also be a combination of a literal string and string tag in the format of “
Liter string
” +
String tag
, for example, CurrentUserHasGroup ("
UserGroupName1
"+{
[Controller]Main.UserGroupName
}).
IMPORTANT: CurrentUserHasGroup
only works for Azure Active Directory (Azure AD) groups that are added to the FactoryTalk Directory, provided that the Azure AD group will not be updated on the Azure side. Anytime the Azure AD group is updated on Azure, you must add the group to the FactoryTalk Directory again for it to get the latest Azure AD group information.
CurrentUserName
( )
The current user name.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal