﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum / StrataFrame Application Framework / Role Based Security  / Set Form Based on CurrentUser/Role / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>forum@strataframe.net</webMaster><lastBuildDate>Fri, 21 Nov 2008 16:35:10 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Set Form Based on CurrentUser/Role</title><link>http://forum.strataframe.net/Topic14637-21-1.aspx</link><description>Teddy and Ben,&lt;/P&gt;&lt;P&gt;Thanks!  The UserName from the System.Environment namespace is exactly what I needed.  I am setting the SF Current User to the AD User, so they are the same after authentication is settled.&lt;/P&gt;&lt;P&gt;Have a good day!&lt;BR&gt;Bill</description><pubDate>Mon, 03 Mar 2008 12:48:12 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Set Form Based on CurrentUser/Role</title><link>http://forum.strataframe.net/Topic14637-21-1.aspx</link><description>Teddy is right about the currently logged in Windows user, and if that's what you're looking for the, that will take care of it.  &lt;/P&gt;&lt;P&gt;If you're looking for the current logged in StrataFrame user, you can get access to the username through the MicroFour.StrataFrame.Security.SecurityBasics.CurrentUser.Username property.  However, the ShowGateway gets called before the ShowLoginAndInitMainForm, so you will want to just move your code that shows the login form to the ShowGateway just like you would have it in the ShowLoginAndInitMainForm method.</description><pubDate>Mon, 03 Mar 2008 08:35:43 GMT</pubDate><dc:creator>Ben Chase</dc:creator></item><item><title>RE: Set Form Based on CurrentUser/Role</title><link>http://forum.strataframe.net/Topic14637-21-1.aspx</link><description>Hi Bill,&lt;P&gt;In your own example instead of &lt;FONT size=2&gt;System.Environment.MachineName i am pretty sure you can do &lt;FONT size=2&gt;System.Environment.UserName, which  returns the logged on user on the machine.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;Then you can extend your users table (or create a new table with additional userinfo and link it to the users table)  with info on which form to load on startup.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;Then you should be able to read the user, query your field with forminfo for that user and show the returned form.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;/Teddy&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Sat, 01 Mar 2008 13:25:32 GMT</pubDate><dc:creator>Teddy Jensen</dc:creator></item><item><title>Set Form Based on CurrentUser/Role</title><link>http://forum.strataframe.net/Topic14637-21-1.aspx</link><description>In order to do what I wanted to do I utilized the ShowGateway() method in the program.cs.  I added two forms to the collection in InitApplication.  Then I added the following code to the ShowGateway method:&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt; (System.&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Environment&lt;/FONT&gt;&lt;FONT size=2&gt;.MachineName != &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"COMPNAME"&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;BR&gt;{&lt;BR&gt;    e.FormIndexToShow = 0;&lt;BR&gt;}&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;else&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;{&lt;BR&gt;    e.FormIndexToShow = 1;&lt;BR&gt;}&lt;BR&gt;&lt;BR&gt;This does work.  My actual code involves a little more string manipulation in order to limit the number of workstations to three that get FormIndex 1; however, if I logged on to those workstations as myself (an admin), it would be nice to get the general window (index 0).  That won't happen, though.  Only the one form will be displayed.  &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;So, here is my question:  how do I set the main form based on the current logged in user name or a role assigned to that user?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;Thanks,&lt;BR&gt;Bill&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Sat, 01 Mar 2008 10:36:12 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item></channel></rss>