Question about: My.User.IsInRole<p align=left><font face=Arial size=2>I hope this is the right place for this question - I haven't found<br>any other group whose name even vaguely would seem likely<br>as a place to ask this question.</font></p> <p align=left> </p> <p align=left><font face=Arial size=2>I'm working on a (VS2008) VB program. It is likely that any<br>number of people might be able to access the program but I<br>wish to control what (specifically) they can do by using their<br>membership in either a local or domain group.</font></p> <p align=left> </p> <p align=left><font face=Arial size=2>VS2008 makes available the &quot;IsInRole&quot; construct which when<br>called returns a T/F if the current authenticated machine user<br>is a member of one of a set of local, domain, or global groups.</font></p> <p align=left><font face=Arial size=2></font> </p> <p align=left><font face=Arial size=2>It is used as follows:</font></p> <p align=left><font face=Arial size=2>     If My.User.IsInRole( _<br>          ApplicationServices.BuiltInRole.Administrator ) Then<br>       ' Whatever code is to be executed...<br>     End If</font></p> <p align=left><font face=Arial size=2></font> </p> <p align=left><font face=Arial size=2>This works perfectly as long as the &quot;role&quot; is one of the VS2008<br>(and NT) standard groups - Administrator, BackUpOperator,<br>etc. Unfortunately, these doesn't seem to be any method/way<br>to specify a group which might be created for this purpose,<br>like &quot;SiteCoordinator&quot; or &quot;SeniorMonitor.&quot;</font></p> <p align=left> </p> <p align=left><font face=Arial size=2>Is anyone familiar with either how this construct can be used<br>to determine membership in a created group or of some other<br>method (preferably in VB) which can be called via a VB<br>program and determine whether an individual is a member of<br>a group - local, domain or global - or not?</font></p> <p align=left><font face=Arial size=2></font> </p> <p align=left><font face=Arial size=2>Thanks.</font><font face=Arial size=2></font></p>© 2009 Microsoft Corporation. All rights reserved.Thu, 03 Jul 2008 17:06:02 Z0b0682d6-81d9-4dcc-aad3-ec68072acb08http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/0b0682d6-81d9-4dcc-aad3-ec68072acb08#0b0682d6-81d9-4dcc-aad3-ec68072acb08http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/0b0682d6-81d9-4dcc-aad3-ec68072acb08#0b0682d6-81d9-4dcc-aad3-ec68072acb08dfschraderhttp://social.msdn.microsoft.com/Profile/en-US/?user=dfschraderQuestion about: My.User.IsInRole<p align=left><font face=Arial size=2>I hope this is the right place for this question - I haven't found<br>any other group whose name even vaguely would seem likely<br>as a place to ask this question.</font></p> <p align=left> </p> <p align=left><font face=Arial size=2>I'm working on a (VS2008) VB program. It is likely that any<br>number of people might be able to access the program but I<br>wish to control what (specifically) they can do by using their<br>membership in either a local or domain group.</font></p> <p align=left> </p> <p align=left><font face=Arial size=2>VS2008 makes available the &quot;IsInRole&quot; construct which when<br>called returns a T/F if the current authenticated machine user<br>is a member of one of a set of local, domain, or global groups.</font></p> <p align=left><font face=Arial size=2></font> </p> <p align=left><font face=Arial size=2>It is used as follows:</font></p> <p align=left><font face=Arial size=2>     If My.User.IsInRole( _<br>          ApplicationServices.BuiltInRole.Administrator ) Then<br>       ' Whatever code is to be executed...<br>     End If</font></p> <p align=left><font face=Arial size=2></font> </p> <p align=left><font face=Arial size=2>This works perfectly as long as the &quot;role&quot; is one of the VS2008<br>(and NT) standard groups - Administrator, BackUpOperator,<br>etc. Unfortunately, these doesn't seem to be any method/way<br>to specify a group which might be created for this purpose,<br>like &quot;SiteCoordinator&quot; or &quot;SeniorMonitor.&quot;</font></p> <p align=left> </p> <p align=left><font face=Arial size=2>Is anyone familiar with either how this construct can be used<br>to determine membership in a created group or of some other<br>method (preferably in VB) which can be called via a VB<br>program and determine whether an individual is a member of<br>a group - local, domain or global - or not?</font></p> <p align=left><font face=Arial size=2></font> </p> <p align=left><font face=Arial size=2>Thanks.</font><font face=Arial size=2></font></p>Fri, 11 Apr 2008 15:50:01 Z2008-04-11T15:50:01Zhttp://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/0b0682d6-81d9-4dcc-aad3-ec68072acb08#b7fe876e-a870-40da-ac77-944b764dd5c0http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/0b0682d6-81d9-4dcc-aad3-ec68072acb08#b7fe876e-a870-40da-ac77-944b764dd5c0Riquel_Donghttp://social.msdn.microsoft.com/Profile/en-US/?user=Riquel_DongQuestion about: My.User.IsInRole<font style="font-family:Verdana" size=2>Hi ,<br><br>You need to use <a title="http://msdn2.microsoft.com/en-us/library/52kd59t0%28VS.71%29.aspx" href="http://msdn2.microsoft.com/en-us/library/52kd59t0(VS.71).aspx">role-based security</a> mechanism in this scenario to authenticate the user. Commonly you can use the following code snippet to authenticate a user.<br><br></font> <p class=MsoNormal style="margin-bottom:0pt;line-height:normal;font-family:Verdana"><font size=2><span style="font-size:9pt;color:blue">Dim</span><span style="font-size:9pt"> principal <span style="color:blue">As</span> IPrincipal</span></font></p> <p class=MsoNormal style="margin-bottom:0pt;line-height:normal;font-family:Verdana"><font size=2><span style="font-size:9pt">principal = System.Threading.Thread.CurrentPrincipal</span></font></p> <p class=MsoNormal style="font-family:Verdana"><font size=2><span style="font-size:9pt;line-height:115%">principal.IsInRole(<span style="color:rgb(163,21,21)">&quot;your group name&quot;</span>)</span></font><br style="font-family:Verdana"></p><font style="font-family:Verdana" size=2><br>Best regards,<br>Riquel<br></font>Tue, 15 Apr 2008 13:57:42 Z2008-04-15T13:57:42Zhttp://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/0b0682d6-81d9-4dcc-aad3-ec68072acb08#f93b654b-6c6d-4db1-9b0e-92d764a21acehttp://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/0b0682d6-81d9-4dcc-aad3-ec68072acb08#f93b654b-6c6d-4db1-9b0e-92d764a21aceRiquel_Donghttp://social.msdn.microsoft.com/Profile/en-US/?user=Riquel_DongQuestion about: My.User.IsInRole<font size=2><span style="font-family:Verdana">We are changing the issue type to “Comment” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions. Thank you!</span><br style="font-family:Verdana"></font>Fri, 18 Apr 2008 02:13:46 Z2008-04-18T02:13:46Zhttp://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/0b0682d6-81d9-4dcc-aad3-ec68072acb08#b75a1c78-ae5d-47d3-ada0-db41846786dchttp://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/0b0682d6-81d9-4dcc-aad3-ec68072acb08#b75a1c78-ae5d-47d3-ada0-db41846786dcdfschraderhttp://social.msdn.microsoft.com/Profile/en-US/?user=dfschraderQuestion about: My.User.IsInRole<p align=left><font face=Arial size=2>Got hit by a virelent bug so this is my first chance to see these responses. I will try it tonight or tomorrow and get back with a report on what happens.</font></p> <p align=left> </p> <p align=left>David</p> <p align=left> </p>Thu, 15 May 2008 19:54:18 Z2008-05-15T19:54:18Zhttp://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/0b0682d6-81d9-4dcc-aad3-ec68072acb08#8f86f148-3bec-4b53-ad1a-a8138a24af1ehttp://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/0b0682d6-81d9-4dcc-aad3-ec68072acb08#8f86f148-3bec-4b53-ad1a-a8138a24af1edfschraderhttp://social.msdn.microsoft.com/Profile/en-US/?user=dfschraderQuestion about: My.User.IsInRole<p align=left><font face=Arial size=2>Well, I had a chance to try suggestion which was offered but, while it made good sense I haven't yet been able to get any code working. (I've read and tried most if not all of the on-line examples and they all are either insufficient (in details) or (apparently) flat out don't work. I haven't given up but I will keep working on it although I may move other elements of the project closer to the burner.</font></p> <p align=left> </p> <p align=left>My thanks. Maybe there'll be a miraculious (ok spekk since that doesn't look spelled correctly) happening which will pour out perfectly working code.</p> <p align=left> </p> <p align=left>David</p> <p align=left> </p> <p align=left>(Boy I wish this thing had a spelling checker built into it!)</p>Fri, 16 May 2008 19:38:08 Z2008-05-16T19:38:08Zhttp://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/0b0682d6-81d9-4dcc-aad3-ec68072acb08#4ec47040-b0ec-4fbb-bf4c-4ed47315a325http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/0b0682d6-81d9-4dcc-aad3-ec68072acb08#4ec47040-b0ec-4fbb-bf4c-4ed47315a325dfschraderhttp://social.msdn.microsoft.com/Profile/en-US/?user=dfschraderQuestion about: My.User.IsInRole Raquel,<br><br>You were kind enough to reply to an earlier question (about role based security - which I still haven't really gotten working, but...) amd I am hoping that perhaps you can direct me on another item.<br><br>If you select the &quot;File&quot; option from the system menu and choose to create a new folder (File|New|Folder) you always get a (an empty) folder of the same size (displayed). Are you aware of any method of altering the size (registry or otherwise) of the folder?<br><br>In conjunction with that, there are COM items (I suppose) that plave an *.ini* file within the a folder which contains the name of an icon file (or dll and icon number) which is displayed as the folder's icon. <br><br>Might there be aware of some means which could store the folder's &quot;height&quot; and &quot;width&quot; in the same sort of file so that it would always be restored hack to the same sife? Being able to post the X and Y<br>location there as well would be a nice touch.<br><br>Thanks.<br><br>David<hr size="1" align="left" width="25%">David SchraderThu, 03 Jul 2008 17:06:02 Z2008-07-03T17:06:02Z