Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Additonal Data for SQL Server Login/User

Additonal Data for SQL Server Login/User

Scheduled Pinned Locked Moved Database
databasequestionsql-serversysadminhelp
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dobrzan
    wrote on last edited by
    #1

    Hi, How can I add additional data to SQL Server 2k login. I have a database with logins/users for each person that can login I need to add extra information and create a relation (based user login or index) to other tables in my database. Sample: "document" has an author, author is a user that can login to SQL server. How can I add relationship from "document" table to SQL server login? Thanks for any suggestions how to do that. If this is not a good idea to create a relationship between SQL server login and other tables, is there other solution for similar problem? regards dobrzan

    C 1 Reply Last reply
    0
    • D dobrzan

      Hi, How can I add additional data to SQL Server 2k login. I have a database with logins/users for each person that can login I need to add extra information and create a relation (based user login or index) to other tables in my database. Sample: "document" has an author, author is a user that can login to SQL server. How can I add relationship from "document" table to SQL server login? Thanks for any suggestions how to do that. If this is not a good idea to create a relationship between SQL server login and other tables, is there other solution for similar problem? regards dobrzan

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      dobrzan wrote:

      How can I add relationship from "document" table to SQL server login?

      What sort of relationship? You can, of couse, use commands like:

      GRANT SELECT ON Document TO AuthorUserName

      See also: GRANT[^] DENY[^] and REVOKE[^] If this is not what you want you will have to explain what you want to do with this "relationship"


      Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

      D 1 Reply Last reply
      0
      • C Colin Angus Mackay

        dobrzan wrote:

        How can I add relationship from "document" table to SQL server login?

        What sort of relationship? You can, of couse, use commands like:

        GRANT SELECT ON Document TO AuthorUserName

        See also: GRANT[^] DENY[^] and REVOKE[^] If this is not what you want you will have to explain what you want to do with this "relationship"


        Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

        D Offline
        D Offline
        dobrzan
        wrote on last edited by
        #3

        What I need is to extend the basic login/account. There is a number of accounts/logins that have access to database. Each user (which is a login/account) can do some things depending on other data collected in database. Example: There is a "customer" table in database. Each "customer" can order "product". There is relationship between customer and product - lets say it's done by "order" table. Now when customer connect to database (using his SQL Server login) I want to have a view that shows what "product" "customer" ordered. So there must be a some kind of way to link SQL Server login with entries from "customer" table. It's quiet simple thing, when I log to codeproject I can track my posts. I can do that without SQL Server, but I want to create secure app - based on SQL Server Login authentication.

        C 1 Reply Last reply
        0
        • D dobrzan

          What I need is to extend the basic login/account. There is a number of accounts/logins that have access to database. Each user (which is a login/account) can do some things depending on other data collected in database. Example: There is a "customer" table in database. Each "customer" can order "product". There is relationship between customer and product - lets say it's done by "order" table. Now when customer connect to database (using his SQL Server login) I want to have a view that shows what "product" "customer" ordered. So there must be a some kind of way to link SQL Server login with entries from "customer" table. It's quiet simple thing, when I log to codeproject I can track my posts. I can do that without SQL Server, but I want to create secure app - based on SQL Server Login authentication.

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          Since all this will be done through an application* you let the business logic in the application (or in stored procedures) filter the data returned to the user of the application.

          dobrzan wrote:

          but I want to create secure app - based on SQL Server Login authentication.

          Current advice is not to use SQL Server Authentication unless you are connecting it to systems that are not windows based. You should be using trusted connections with Windows Authentication. What you are suggesting is less likely to secure your system because your users will have some direct access to your SQL Server (even if they don't know it). This access can be used by an attacker to compromise your system. All an attacker needs is an account to your application and you automatically give them an account to the datbase. If you have a web application, it will probably try to connect to SQL Server using the ASPNET account if you let it use a trusted connection. Let it do that. Create your own user tables to handle the users of your application. Do not use the sysusers table in SQL Server, it is not designed for that purpose. you are not going to give your customers direct logins to your SQL Server as that would be nuts - Imagine if Code Project added a login in its SQL Server for each of its 3million+ members - it also screws with connection pooling making it very inefficient


          Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

          D 1 Reply Last reply
          0
          • C Colin Angus Mackay

            Since all this will be done through an application* you let the business logic in the application (or in stored procedures) filter the data returned to the user of the application.

            dobrzan wrote:

            but I want to create secure app - based on SQL Server Login authentication.

            Current advice is not to use SQL Server Authentication unless you are connecting it to systems that are not windows based. You should be using trusted connections with Windows Authentication. What you are suggesting is less likely to secure your system because your users will have some direct access to your SQL Server (even if they don't know it). This access can be used by an attacker to compromise your system. All an attacker needs is an account to your application and you automatically give them an account to the datbase. If you have a web application, it will probably try to connect to SQL Server using the ASPNET account if you let it use a trusted connection. Let it do that. Create your own user tables to handle the users of your application. Do not use the sysusers table in SQL Server, it is not designed for that purpose. you are not going to give your customers direct logins to your SQL Server as that would be nuts - Imagine if Code Project added a login in its SQL Server for each of its 3million+ members - it also screws with connection pooling making it very inefficient


            Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

            D Offline
            D Offline
            dobrzan
            wrote on last edited by
            #5

            So you suggest that I should use one login or windows based auth. to give users access to database (SQL Server) and distinguish each user by my own login logic in my app or web page. Am I right? Is this what others do? Anyway thanks for help.

            C 1 Reply Last reply
            0
            • D dobrzan

              So you suggest that I should use one login or windows based auth. to give users access to database (SQL Server) and distinguish each user by my own login logic in my app or web page. Am I right? Is this what others do? Anyway thanks for help.

              C Offline
              C Offline
              Colin Angus Mackay
              wrote on last edited by
              #6

              dobrzan wrote:

              So you suggest that I should use one login or windows based auth. to give users access to database (SQL Server) and distinguish each user by my own login logic in my app or web page.

              Yes.

              dobrzan wrote:

              Is this what others do?

              Of course.


              Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups