473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Sql server group name from VB

I want to set up different user privileges on the sql server using
groups. At the moment im a little stuck on which way to go with it. I'm
making different forms for each user, depending on their privileges. If
I set up a db with username and passwords, I can check the user against
it and pull their "privilege level" from there.

But i wanted to take advantage of windows authentication so that when
the user contacts sql server, i can pull their group name and assign
forms accordingly. This way, their group name is their privilage level,
and is more managable than i seperate db.

Does anyone know(if possible) how to get the users group name from
vb.net.

Thanks, you guys are really good.
D

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #1
1 1420
Hi,

Take a look at WindowsPrincipal.isinrole

http://msdn.microsoft.com/library/de...nroletopic.asp

Dim wi As System.Security.Principal.WindowsIdentity =
System.Security.Principal.WindowsIdentity.GetCurre nt()

Dim wp As New System.Security.Principal.WindowsPrincipal(wi)

dim r as System.Security.Principal.WindowsBuiltInRole

Trace.WriteLine(String.Format("{0} is in {1} = {2}", wp.Identity.Name,
r.Administrator.ToString, wp.IsInRole(r.Administrator)))

Trace.WriteLine(String.Format("{0} is in {1} = {2}", wp.Identity.Name,
r.BackupOperator.ToString, wp.IsInRole(r.BackupOperator)))

Trace.WriteLine(String.Format("{0} is in {1} = {2}", wp.Identity.Name,
r.PowerUser.ToString, wp.IsInRole(r.PowerUser)))

Trace.WriteLine(String.Format("{0} is in {1} = {2}", wp.Identity.Name,
r.Guest.ToString, wp.IsInRole(r.Guest)))

Ken

------------------------

"Dagoberto Aceves" <da*****@devdex.com> wrote in message
news:O4**************@TK2MSFTNGP09.phx.gbl...
I want to set up different user privileges on the sql server using
groups. At the moment im a little stuck on which way to go with it. I'm
making different forms for each user, depending on their privileges. If
I set up a db with username and passwords, I can check the user against
it and pull their "privilege level" from there.

But i wanted to take advantage of windows authentication so that when
the user contacts sql server, i can pull their group name and assign
forms accordingly. This way, their group name is their privilage level,
and is more managable than i seperate db.

Does anyone know(if possible) how to get the users group name from
vb.net.

Thanks, you guys are really good.
D

*** Sent via Developersdex http://www.developersdex.com ***

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
5
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create...
2
by: Mark Fisher | last post by:
From Enterprise Manager on my PC, how do I connect to a remote server over the internet - I have the IP address, User Name and Password. Thanks
1
by: srihari | last post by:
Hai, I am trying to install IBM DB2 8.1 on Red Hat linux 8.0. My machine is Intel XEON 64bit. The installation went well except for the creation of tools catalog. When I tried to install the tools...
5
by: pberna | last post by:
Dear all, I built a Web Form application to start and stop a Windows Service remotely. I successful tested the application on Windows 2000 server + IIS. I must include the ASPNET user to the...
5
by: Ron L | last post by:
I have an application I am developing which is using remoting to have a smart client connect to a remote database via IIS. There are certain functions that we only want the user to be able to...
1
by: lecnac | last post by:
Sorry for the repost. I must have done something wrong when I tried to post my reply (I can't seem to find it). Anyway, I'd really appreciate any help that anyone could provide. My issue is...
4
by: shashank kadge | last post by:
hi all, i am trying to get local admin users and groups on a windows server. here is the C# code that i am using...
1
by: eblackmo | last post by:
I have a test network consisting of four servers running windows 2003 server R2 SP2. I have set up a domain which functioned correctly for about a day and a half until the other servers decided they...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.