February 17, 2009 at 11:25 pm
I'm building an application where it is asking the user for SQL Credentials to make Schema Updates. The credentials can be either and SQL User & Password or Trusted Connection (ie the currently logged on windows user).
Now, if the user uses Trusted Connection, the application created a connection string and connects. But how can it be sure that the user is an SQL Admin before the Schema Update starts?
Thanks
JP
February 18, 2009 at 8:40 am
IS_MEMBER function checks whether the current user is a member of the specified windows or sql database role. And to check specifically for object level permissions, see PERMISSIONS function.
--Ramesh
February 18, 2009 at 9:02 am
Thanks
Although it's not exactly what I needed, I found the Function Is_SrvRoleMember('SysAdmin') from it's help page.
JP
February 18, 2009 at 9:09 am
January 16, 2014 at 12:08 pm
January 20, 2014 at 6:21 am
Testing for sysadmin is not really the right thing to do in this case. Best practice is to use the lowest possible permissions needed to complete a task.
The permission needed is ALTER ANY CREDENTIAL and you should test for this. It is possible to grant this permission to any user, so you do not need to be a Sysadmin in order to create a credential.
Original author: https://github.com/SQL-FineBuild/Common/wiki/ 1-click install and best practice configuration of SQL Server 2019, 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005.
When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist - Archbishop Hélder Câmara
January 20, 2014 at 4:18 pm
My feeling is that if an application has any more than (at the most) read/write privs, then the application is incorrectly written. The application should be calling on prived stored procedures to do the job safely.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 21, 2014 at 2:46 am
The application should be calling on prived stored procedures to do the job safely.
+1
Original author: https://github.com/SQL-FineBuild/Common/wiki/ 1-click install and best practice configuration of SQL Server 2019, 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005.
When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist - Archbishop Hélder Câmara
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply