Results 1 to 5 of 5

Thread: virtualtable userid and passwprd by login

  1. #1
    Senior Member
    Join Date
    Feb 2012
    Posts
    1,211

    virtualtable userid and passwprd by login

    Hi,

    Finally getting back into the swing of things.
    I have a new web project that will be used by many different companies. The back-end data is in SQL Server so I need to create a virtualtable.

    For security/auditing purposes, I need to have each connection to the server be from the client with the clients login. The logins are mapped to schemas inside SQL Server.

    So that would mean that I need to have some way of grabbing the username and password from the web login, and then dynamically adding that to the VT definition.

    What would be the best way to accomplish this.
    Thanks

    Herb

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,769
    Hi Herb,

    The uid and pwd that are specified in the CONNSTR for the virtual table can be specified as a {macro} that is a function call e.g {getUsernameAndPassword()}

    this function should reside in the library directory so it’s app independent.

    That function can reference the username() and look it up in the system table to get the password.

    You can then return a string “uid=username;pwd=password” to be substituted into the CONNSTR.

    See:
    https://www.lianja.com/doc/index.php/USERNAME()
    https://www.lianja.com/doc/index.php/SYSROLES

    I should also add that in Lianja 5 if the CONNSTR is omitted from the virtual table definition and SET CONNSTR TO “yourconnstr” is in effect that is used globally. This provides the ability to switch back ends without having to make any code changes.

    The SET CONNSTR command can be executed in the database open event.
    https://www.lianja.com/doc/index.php/Database_Events
    Last edited by barrymavin; 2018-12-23 at 03:49.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  3. #3
    Senior Member
    Join Date
    Feb 2012
    Posts
    1,211
    Hi Barry,

    That's so perfect.

    I will use that functionality in version 5.

    Thanks!!

    Herb

  4. #4
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    1,942
    Hi Barry,

    Just a reminder that the BeforeOpenTable event ER would make this scenario complete. ��,

    Hank

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,769
    Hi Hank,

    Yes itís on my todo list for Lianja 5.

    Probably need dbc_beforeopentable, dbc_afteropentable, dbc_beforeclosetable and dbc_afterclosetable.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us