473,498 Members | 37 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to discover either windows group or SQL login

Hello,

I am putting together a row level security plan for our sales
database. I will give a brief description of the method I am thinking
of using to give you an idea of how I will need to be able to discover
the group or login the user is using to access the data.

I have a table called salesfact, it has all the sales info for all the
branches of our company. Each order(row) that is inserted has an entry
in the division_number column to describe which branch the order
belongs to. I have created another table(Branch_Folks) that has four
columns; username, windows_group, SQL_Login and division_number.

I am using a view and SQL logins to control access to the data based
on the user, the SQL logins give windows groups access to the view.
Only users that are added to the specific branch groups will have
access to the logins, but if a user is added to the group without me
being notified, then he will not have a corresponding entry in the
Branch_Folks table. Currently I am using the SUSER_SNAME() function to
determine which user is accessing the data from the view that I have
created. The view uses this select statement to filter the data based
on the user & division.

Select * from tsalesfact A, Branch_Folks B where SUSER_SNAME() =
B.username and A.division_number = b.division_number

This method works fine, but I will have to manually maintain the user
list in the Branch_Folks table in case a new user joins the windows
branch group. I would like to use a function similar to SUSER_SNAME()
that can determine the windows group or SQL Login a user is using.

Does anyone know of a way to do this??

Thanks a ton,

Tim
Jul 20 '05 #1
1 1993
[posted and mailed, please reply in news]

TimG (ti****@hotmail.com) writes:
This method works fine, but I will have to manually maintain the user
list in the Branch_Folks table in case a new user joins the windows
branch group. I would like to use a function similar to SUSER_SNAME()
that can determine the windows group or SQL Login a user is using.


Have you looked at is_member()? If I understand you correctly, this
seems to be the function you are looking for.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

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

Similar topics

1
680
by: TimG | last post by:
Hello, I am putting together a row level security plan for our sales database. I will give a brief description of the method I am thinking of using to give you an idea of how I will need to be...
9
1942
by: Justin Engelman | last post by:
Hi, I have a website that uses an ISAPI filter that will redirect anyone going to any page on the site to an SSL login page (on a different website with the same root domain) if they do not have...
8
4876
by: Mark White | last post by:
Hey everyone I'm having a great deal of problems finding this information through google and yahoo, so I turn to you on this. I have a Windows app running on XP. I am able to caputre the...
7
2652
by: Nick | last post by:
Platform: Visual Studio 2003 Language: C# NOTES: 1. Application will need to run on Windows 2000, Windows 2003, Windows XP 2. Client machines will be standalone NOT part of a domain. 3. I...
4
7701
by: Gav | last post by:
Hi, I am writing a windows form application (C#) which access's data from an SQL server. The SQL server is using windows authentication only. At the moment I have to grant the domain users...
6
12756
by: Not Me | last post by:
Hey, We have an sql server 2000 machine and IIS 6 machine running seperately but on the same domain. I can connect fine to the database without using impersonation, but when it's enabled I get...
30
6930
by: diane | last post by:
I've got an application running with table-based security: i capture the user's windows login with fOsusername, then have them enter a password checked against their username/login in my own table....
1
8545
by: rrangaprasad | last post by:
i'm trying to create a 'kiosk' type of workstation, based on a particular login (where the desktop is pretty much locked and the user won't have access to run commands, change taskbar, etc). Now, the...
3
2998
by: netzorro | last post by:
Hi all, I have an application and each user has a different db2 login user. For db2 I have to define the users on Windows OS (2003) Is there a way to disable those windows users but allow them...
1
1500
by: =?Utf-8?B?RGVyZWsgTWFr?= | last post by:
I had a Home PC with XP prof on it, I had installed an additional harddisk with XP os on it. After the installation, I tried to boot up my original harddisk with the XP OS, When I start it up, it...
0
7124
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
7163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7375
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
3090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.