<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to GetCurrentUser</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/4b34e70357/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Visualization/thread/4b34e70357/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Visualization/thread/4b34e70357/</id><updated>2024-01-23T07:12:23.352000Z</updated><subtitle>Recent posts to GetCurrentUser</subtitle><entry><title>GetCurrentUser</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/4b34e70357/?limit=25#8ea5" rel="alternate"/><published>2024-01-23T07:12:23.352000Z</published><updated>2024-01-23T07:12:23.352000Z</updated><author><name>TimvH</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.com0e7c366dad802b769f4a5737efdc9b27ce345b9c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;if you just want to show the currently logged in user in the visualization, then just create a field with text %s and as text variable VisuElems.CurrentUserName&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>GetCurrentUser</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/4b34e70357/?limit=25#3213" rel="alternate"/><published>2024-01-23T01:01:51.330000Z</published><updated>2024-01-23T01:01:51.330000Z</updated><author><name>pavel-doreng</name><uri>https://forge.codesys.com/u/pavel-doreng/</uri></author><id>https://forge.codesys.com228417dfaaa2cf8c5c753460e7d29e207fc1689c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi&lt;br/&gt;
im only have 3 groups \ users - the deafault ones&lt;br/&gt;
admin \ servie \ operator&lt;/p&gt;
&lt;p&gt;i JUST NEED TO KNOW WHO IS CURRENTLY LOGGED IN&lt;br/&gt;
TO Display the user name , thats all&lt;br/&gt;
this code above do not work for me please help&lt;br/&gt;
im sure its very simple&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>GetCurrentUser</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/4b34e70357/?limit=25#9d95" rel="alternate"/><published>2022-08-08T14:19:59.703000Z</published><updated>2022-08-08T14:19:59.703000Z</updated><author><name>timvh</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.combe5924347d8419f66a7f480725e8676851b45822</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;This doesn't work when you have multiple clients, so you must iterate over the clients and then get the required info per client.&lt;/p&gt;
&lt;p&gt;E.g. add this to a program which you call from the VISU_TASK&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt;    pClient : POINTER TO VisuElems.VisuElemBase.VisuStructClientData;&lt;/span&gt;
&lt;span class="err"&gt;    dwTargetVisuGroupID : DWORD;&lt;/span&gt;
&lt;span class="err"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;VisuElems.VisuElemBase.g_ClientManager.BeginIteration();&lt;/span&gt;
&lt;span class="err"&gt;WHILE (pClient := VisuElems.VisuElemBase.g_ClientManager.GetNextClient()) &amp;lt;&amp;gt; 0 DO&lt;/span&gt;
&lt;span class="err"&gt;    IF pClient^.GlobalData.ClientType = VisuElems.VisuElemBase.Visu_ClientType.TargetVisualization THEN&lt;/span&gt;
&lt;span class="err"&gt;        dwTargetVisuGroupID := pClient^.GlobalData.CurrentUserGroupID;&lt;/span&gt;
&lt;span class="err"&gt;    END_IF&lt;/span&gt;
&lt;span class="err"&gt;END_WHILE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;See for a general other way of using this "Client handling":&lt;br/&gt;
&lt;a href="https://faq.codesys.com/display/CDSFAQ/WebVisu%3A+Reading+the+IP+Address+of+the+Client" rel="nofollow"&gt;https://faq.codesys.com/display/CDSFAQ/WebVisu%3A+Reading+the+IP+Address+of+the+Client&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>GetCurrentUser</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/4b34e70357/?limit=50#7e3b" rel="alternate"/><published>2022-07-15T12:14:16.907000Z</published><updated>2022-07-15T12:14:16.907000Z</updated><author><name>tvm</name><uri>https://forge.codesys.com/u/tvm/</uri></author><id>https://forge.codesys.com9d82ca25c4bbebb660e11cbb9ec83ed9eafb4ca7</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I'm using the following code to get information on the current logged in user:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt;    CurrentUser:        VisuUserManagement.VUM_User;&lt;/span&gt;
&lt;span class="err"&gt;END_VAR&lt;/span&gt;
&lt;span class="c"&gt;CurrentUser:= VisuUserManagement.g_VisuUserMgmtIntern.GetCurrentUser();&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;If I call this with no user logged in, I get the screenshot below, as expected.  When I log in, I can see the username, etc, as expected.  However, when I log out, the username, password, user groups, etc stay as if I'm still logged in.  I would expect to see empty strings in the username, and 0's in the groups, just like the initial screenshot.  Do I have to reset it somehow?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>