Re: SQL Roles
From: Alek Davis (alek_DOT_davis_AT_intel_DOT_com)
Date: 04/11/03
- Next message: Rob Edwards: "Impersonation/Authentication Frustration"
- Previous message: Marlene A. Roman: "Issue with Integrated Security"
- In reply to: Darren: "SQL Roles"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Alek Davis" <alek_DOT_davis_AT_intel_DOT_com> Date: Fri, 11 Apr 2003 11:54:42 -0700
Darren,
I assume that you meant the roles (plural), not the role (singular), since
the user can belong to many SQL server roles. I may be wrong, but I doubt
that there is an API which would return you a list of SQL roles for a user,
unless you query system tables directly (this assumes that you either
connect to SQL server using a separate account and the user's Window's
credentials match SQL credentials or the user can connect to SQL server and
query system tables). By the way, there are SQL server roles (e.g. sysadmin)
and there are also database roles (e.g. db_owner); I guess that you
understand the difference.
If you want to quickly check if user has a role, you can call
IS_SRVROLEMEMBER or IS_MEMBER function (they will check role membership for
currently connected user). Otherwise, you should probably get the list of
all roles and then verify whether the user has each role. In non-.NET world,
the cleanest way to do this would be via SQL-DMO. I am not sure what would
be the best option for .NET.
You may want to post this question to one of the SQL newsgroups.
-- Alek
"Darren" <darren@dns-solutions.com.au> wrote in message
news:043301c2fe5b$fa9f0600$a401280a@phx.gbl...
> Hello All,
> I am using windows authentication and impersonation in
> an intranet application, this works fine, however can
> anyone advise me how to return the SQL role a user
> belongs to?
>
> Thanks in advance
>
> P.S. Thanks to those who assisted my last post
- Next message: Rob Edwards: "Impersonation/Authentication Frustration"
- Previous message: Marlene A. Roman: "Issue with Integrated Security"
- In reply to: Darren: "SQL Roles"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|