The example for this is below. In the Workflow - Common Script there is an event trigger section for ''CanLogin''. This workflow event is triggered before the login happens and therefore can check the users as they are attempting to log in to the project.
The project workflow assumes that you have a connection to the project and therefore do not need to create a connection. So, you can extend the OTA/COM API in the workflow as if you have just created an API connection (i.e. workflow assumes TDConnection object as your root object). Therefore, since there is a DomainName property for the TDConnection object, you can simple use that to see what domain you are currently in and make a comparison.
'Place in Workflow - Common Script
Function CanLogin (DomainName, ProjectName, UserName)
If DomainName <> ''production'' Then
MsgBox ''You are not logged into a production testing environment.''
End If
CanLogin = True
End Function