The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Impersonate
Posted: 27 Feb 07 10:47 AM
|
fiogf49gjkf0d Hello I am currently trying to use .Net with slx 6.2. My major concern is the security. therefore, i try to use "Impersonate" in the connection string: In my web config, I get: ersist Security Info=Trueassword=blabla;User ID=blabla;Initial Catalog=BLABLA;Location=BLABLA;providerName=System.Data.OleDb" />
then my code is:
Dim slxuserid As String
slxuserid = "U6BLABLA0078" Dim cn As String = Nothing Dim settings As ConnectionStringSettings = ConfigurationManager.ConnectionStrings("SlxProvider") If Not settings Is Nothing Then cn = settings.ConnectionString End If cn = cn & ";Impersonate = " & slxuserid
Dim dt As DataTable = New DataTable Dim conn As OleDb.OleDbConnection = New OleDb.OleDbConnection(cn) Dim adapter As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter adapter.SelectCommand = New OleDb.OleDbCommand(sql, conn) adapter.Fill(dt)
When I run a simple query such as select * from opporunity, it does not apply the SLX security... Would anyone know why?
Also, i was wondering: the SLX OLEDB does not allow to do complexe queries, would you know if it is possible to use the SLX security when creating a view in SQL Server?
THANKS A LOT FOR YOUR HELP
Tonio
|
|
|
|
Re: Impersonate
Posted: 27 Feb 07 1:28 PM
|
fiogf49gjkf0d okay... I got the answer for the first issue --> use the username and not the userid.... however, I tried using a sql server view and it does not work. I guess it is because the view is not declared in saleslogix like the tables... Therefore, would anyone know a way to do complexe queries despite the fact that SLX OLEDB Provider does not handle every SQL functionalities.
Thanks |
|
|
|
Re: Impersonate
Posted: 28 Feb 07 1:42 AM
|
fiogf49gjkf0d Hi Tonio,
Was the view owned by sysdba? If not i dont think it would work (the connection uses sysdba to access the database) - but otherwise you can use views...
Thanks
Nick |
|
|
|
Re: Impersonate
Posted: 28 Feb 07 8:39 AM
|
fiogf49gjkf0d Hello Nick
Thanks for your answer. The view is actually owned by the sysdba. The fact is that when the view is "select * from opporunity", a query on this view is going to display all the opportunities without considering the seccodeid of the team who owns the opportunity. Therefore the view would work fine if i did not have a security concern. If you have any other thoughts...
Thanks
Tonio |
|
|
|
Re: Impersonate
Posted: 28 Feb 07 9:31 AM
|
fiogf49gjkf0d Here is an example of the sql for the account view:
SELECT A1.*, S0.ACCESSID AS ACCESSID_ FROM sysdba.ACCOUNT A1 INNER JOIN sysdba.SECRIGHTS S0 ON A1.SECCODEID = S0.SECCODEID
you can then say where userid = accessid; this is essentially adding your own security, obviously use opportunity table for if you want the security in this area....
Thanks, Nick |
|
|
|
Re: Impersonate
Posted: 28 Feb 07 11:21 AM
|
fiogf49gjkf0d Could you give an example of what kind of queries you're unable to run through SLX OLEDB? It does have limitations but usually you can work around them. |
|
|
|
Re: Impersonate
Posted: 16 Apr 07 12:42 PM
|
fiogf49gjkf0d To access the view thru the provider, you would need to be running SLX v7. Log into either Architect or Workgroup Administrator, open the DB manager and Enable the view. This creates the necessary records inside the SecTableDefs and ResyncTableDefs.
Once you have done this you will be able to query that view thru the SLX Provider. |
|
|
|
Re: Impersonate
Posted: 16 Apr 07 2:09 PM
|
Raul,
I suspect you have been misinformed/mislead by the new feature in 7.x. You can query SQL Views through the provider without placing them in the metadata tables. The reason to add views to the metadata tables is to ensure they are accessible via the query builder within the client (and potentially to sync the definition to remotes - the jury is still out on this one and apparently we are all to lazy to test it ). When writing code to query the database, there is no need to add views to the SalesLogix metadata tables.
Timmus |
|
|
|
Re: Impersonate
Posted: 16 Apr 07 2:28 PM
|
Thanks for the clarification.
I did try it and you were correct, no need to Enable the view to be able to query it via Code.
I do have done some work with Views and Bundle them to transfer across systems (and the view gets pushed to the DB as a Table, even though the Metadata on the target system still flag it as a View) [Then again, I bundled it with the "Create Table" option since I couldn't find a "Create View" alternative while bundling. [Luckily these views were being used for Admin purposes, so a quick SQL script and we had the system configured properly] |
|
|
|
Re: Impersonate
Posted: 16 Apr 07 6:39 PM
|
There is NO support for creating views in SalesLogix or bundle actions.. -- rjl |
|
|
|