Query LDAP/ADSI For Group Members?

May 16, 2007

I am trying to get members of an Active Directory group by querying the AD server from Transact-SQL (SQL Server 2005). Although there does not seem to be any written list of LDAP attributes that can be queried in AD (or I am not finding it), I have gotten this far:



SELECT * FROM

OPENQUERY( MYSERVER,

'SELECT cn, msExchHomeServerName, userPrincipalName FROM ''LDAP://CN=Users,DC=MYSERVER,DC=COM'' WHERE userPrincipalName=''*'' ')



This gives me a user list. But I can't find the syntax or attribute name(s) to query in order to get the membership of a specific group - for example, the group "SQL_Developers".



Anybody out there familiar enough with LDAP, AD and OPENQUERY() to give me a hand?



Thanks....



Tom

View 2 Replies


ADVERTISEMENT

ADSI LDAP Query 1000 Record Limit For MSSQLServer Linked Server

Jul 23, 2005

Hi,I have successfully set and used a linked server to query ADSI.Since this question also concerns MSSQLServer, I've cross posted it --I hope this is not a breach of etiquette.I have successly created a view based on the linked server.Unfortunately, it only shows 1000 records, and there does not seem tobe any way to set the Page Size.I found the following:http://support.microsoft.com/defaul...kb;en-us;243281Which seems to imply that the default can be set by changing registrykey: "HKEY_CURRENT_USERSoftwarePoliciesMicrosoftWind owsDirectoryUI"I have set this key, and also set it for the user account under whichMSSQLServer runs. The value persists after a reboot. The Domain Grouppolicy sets the default to 15000.This behaviour is not restricted to the linked server. If I use thescript found here:http://hacks.oreilly.com/pub/h/1121 I can access morethan 1000 records, but only if I set the "Page Size" property. If Icomment it out to let the default hold, it is 1000.It must be settable SOMEWHERE or the whole linked server thing is ofvery limited use.At present, the best solution I've been able to come up with is to usethe above script modified to run as a DTS package. Yuck.TIA,BM

View 2 Replies View Related

LDAP Vs ADSI Parameter Problem

Nov 22, 2006

Dear friens,
I'm having a problem with ADSI and SQL... Could you tell me, where is the error? The problem surge when I try to use parameter€¦

"
CREATE PROCEDURE TEST
AS
DECLARE @charVariable nvarchar(11);
DECLARE @SQLString NVARCHAR(500);
DECLARE @ParmDefinition NVARCHAR(500);

/* Build the SQL string one time. */
SET @SQLString = N'SELECT * FROM OPENQUERY(ADSI,''SELECT * FROM ''''LDAP://DC=GrupoCGD,DC=com'''' WHERE objectClass = ''''user'''' AND sAMAccountName=@UserID'')'

/* Specify the parameter format one time. */
SET @ParmDefinition = N'@UserID varchar(11)';

/* Execute the string with the first parameter value. */
SET @charVariable = 'rhs0002';
EXECUTE sp_executesql @SQLString, @ParmDefinition,
@userID = @charVariable;
"

ERROR is:
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "SELECT * FROM 'LDAP://DC=GrupoCGD,DC=com' WHERE objectClass = 'user' AND sAMAccountName=@UserID" for execution against OLE DB provider "ADSDSOObject" for linked server "ADSI".


FOR EXAMPLE THIS VIEW WORKS€¦
USE [dbGestaoDesktop]
GO
/****** Object: View [dbo].[AD_VW_DIR_Users] Script Date: 11/22/2006 11:53:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[AD_VW_DIR_Users]
AS
SELECT TOP (100) PERCENT cn, createTimeStamp,department, extensionAttribute1
FROM OPENQUERY(ADSI, '
SELECT createTimeStamp,cn, department, extensionAttribute1
FROM ''LDAP://OU=DSO,OU=Utilizadores,OU=Servicos-Centrais,OU=cgd,DC=GrupoCGD,DC=com''

WHERE objectclass=''user''


')
AS MyTable
WHERE (NOT (cn IS NULL))
ORDER BY createTimeStamp

THANKS

View 6 Replies View Related

SQL 2012 :: Adding ADSI LDAP Server Connection Inside CMS Collection?

Jun 17, 2014

Is there a way to query the LDAP from inside the CMS? I know I can add a linked server in a singular instance but I'd like to do it inside a server group. I haven't found anything so far about querying the LDAP inside a server group so it might not be possible?

View 4 Replies View Related

Query Users In A Security Group With LDAP

Aug 11, 2004

I have a linked server set up and working correctly. I can create a query to get all the users from active directory with something like this:

SELECT [name], [samaccountname] from OpenQuery( ADSI,
'SELECT name, samaccountname FROM ''LDAP://DC=domain,DC=com'' WHERE objectClass = ''user'' and objectCategory=''Person''')

Now I am trying to select all the users in a specifed security group, but I am not having much luck. What is the best way to get this?

Thanks much.

View 3 Replies View Related

Group Login Members

Feb 20, 2008

Hi All,

'SACCAPRiskGroup' is my group login which has few users.
Now i want to know all users in this group. For this i am using
EXEC sp_helprolemember 'SACCAPRiskGroup'.

But no luck.

Can any one help me in this.

Thanks.
Malathi.

View 2 Replies View Related

Group Calculated Members Into A Named Set

Feb 6, 2008

Hi,
It's a long story i'll try to make short, I am running a MDX query through Integration Services, this query is very very memory intensive, so intensive I get a System.outofmemory error. The workaround for this was getting the data in smaller ranges. this works fine in Management Studio.

select { many measures and calculated members} on columns,
[Cuenta].[Cuenta].&[1]: [Cuenta].[Cuenta].&[10000] on rows
from DB
WHERE [Tiempo].[Mes].&[2007-09-01T00:00:00] : [Tiempo].[Mes].&[2007-11-01T00:00:00]

Now, in Integration services the optimal way of running a MDX query should be through an OLEDB source, but as it's stated in many sites around the web there is an error that hasn't been fixed. So I moved to a Datareder which is much slower, but works... kind of... to get the whole data out of the cube I am getting it in ranges which I should change with parameters, but MDX doesn't support parameters so I have to change the whole query using an expression.

Finally the problem with this is that the query I am running is longer than 4000 characters which is the limit for an expression on integration services. Here is when someone told me to shrink my query by using named sets, and this is what i don't know how to do, is there any way of grouping all the calculated members I have created in one named set or something alike.

thanks!

View 4 Replies View Related

LDAP - HOW DO I CONNECT TO LDAP DB FROM SQL SERVER 2005?

Dec 12, 2006

This is something that should not be so difficult, but it is proving to be very cumbersome.
I need to query an LDAP database on a Linux server FROM a sql server, namely sql server 2005.
I have found bits and pieces, but can€™t seem to put it all together yet €“ it should be easy, but it€™s proving to be very difficult.
It seems like you can either link an LDAP server through sp_addlinkedserver OR through enterprise manager/sql server studio, you can create a LINKED SERVER.
The problem is HOW to do this.
Here are the parameters for the ldap server:
Server name: serverabc
Ldap info (which I don€™t know how to label) is: 'ou=Hosts,dc=mc,dc=vanderbilt,dc=edu'.
I was able to somehow get this to work last week, but now it€™s not working - it didn't return any data, as i don't have any ldap hierarchy specified, but at least it came back with "command completed successfully":
SELECT * FROM OPENQUERY( [serverabc],
'SELECT * FROM ''LDAP://serverabcu/ OU=Hosts,DC=mc,DC=vanderbilt,DC=edu''
')
With all the ldap usage out there, this is really frustrating not being able to find out how to do this.
Any help is greatly appreciated.
Thanks


View 3 Replies View Related

Mapping Active Directory Group Members To SQL Server Roles

Sep 12, 2006

My question is I have a SQL Server running on Web Server which is a member of a 2000 Active Directory, I only grant access to the database via Global Groups from the Active Directory. When I log onto the database via Windows Authentication the actual user shows up in the master.dbo.sysprocesses table, I can tell what database that process is going to but not how that user is being translated to the Global Group that was actually given access. I need the actual database user name which is the Global Group name that had permissions granted via user defined database roles so that I can do some pre-processing in an ASP.NET application so that I know what parts of a form are updatable or not.

View 1 Replies View Related

SQL Server 2014 :: Recursive Family - Group All Related Members Under Same FamilyID

Jun 24, 2014

I have a family table and would like to group all related members under the same familyID. This is a replication of existing business data, 14,000 rows. The familyID can be randomly assigned to any group, its sole purpose is to group the names:

declare @tv table (member varchar(255), relatedTo varchar(255))
insert into @tv
select 'John', 'Mary'union all
select 'Mary', 'Jessica' union all
select 'Peter', 'Albert' union all

[Code] ....

I would like my result to look like this:

familyID Name
1 John
1 Mary
1 Jessica
1 Fred
2 Peter
2 Albert
2 Nancy
3 Abby
4 Joe
4 Frank

View 3 Replies View Related

LDAP Query Returning Erroneous Values

Jan 24, 2007

I'm trying to query an LDAP server from a stored procedure written for the CLR but not getting the expected results.

The code is as follows:

<Microsoft.SqlServer.Server.SqlProcedure()> _
Public Shared Sub LDAP_UserExists(<Out()> ByRef exists As Boolean, ByVal username As SqlString)

Dim adspath As New StringBuilder()
adspath.Append(LDAP://[.......]/ou=Members/cn=)
adspath.Append(username)

If username.ToString().Length > 0 Then
Dim uobject As New DirectoryEntry(adspath.ToString(), "", "", System.DirectoryServices.AuthenticationTypes.Anonymous)
If Not (uobject Is Nothing) Then
exists = True
Else
exists = False
End If
End If

End Sub

The same code works fine from an ASP.NET. If I deploy the code and execute it with

exec LDAP_UserExists 'username'

I receive the error

Error converting data type varchar to bit.

And if I right-click and select "Execute Stored Procedure..." I receive @exists = 1 and Return Value = 0, regardless of the value I pass in as the username parameter.

Given that the same code works correctly on the ASP.NET page I suspect that this error has something to do with the <out()> parameter in the stored procedure declaration.

Can anyone suggest the correct method of performing this query?

View 1 Replies View Related

Query LDAP/Active Directory In Stored Procedure

Apr 28, 2004

I know you can access LDAP via ADO.NET and the ADsDSOObject Provider.

Is there away to do it within a SQL Server Stored Procedure?

Thanks,
Tim

View 2 Replies View Related

SQL 2005 LDAP Query Error: Msg 7321, Level 16

Aug 4, 2006

Hello I am trying to run a query via tsql against ad. Below is the error I am getting. I have read the http://msdn2.microsoft.com/en-US/library/ms190803.aspx and changed the domain but still having issues. Any help would be appreciated.

 

EXEC sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces',

'ADSDSOObject', 'adsdatasource'

GO

SELECT *

FROM OPENQUERY( ADSI,

'SELECT Name, SN, ST

FROM ''LDAP://ADSISrv/ OU=Users,DC=XXXXX,DC=LOCAL''

WHERE objectCategory = ''Person'' AND

objectClass = ''user''')

Msg 7321, Level 16, State 2, Line 1

An error occurred while preparing the query "SELECT Name, SN, ST

FROM 'LDAP://ADSISrv/ OU=Users,DC=XXXXX,DC=LOCAL'

WHERE objectCategory = 'Person' AND

objectClass = 'user'" for execution against OLE DB provider "ADSDSOObject" for linked server "ADSI".

View 14 Replies View Related

Transact SQL :: LDAP Query Checking When Created Within Last 7 Days

Nov 6, 2015

I currently have an ldap query in a stored procedure that is working fine but is checking the 'whenCreated' attribute against a hardcoded data.

SELECT * FROM OpenQuery (
  ADSI,  
  'SELECT  whenCreated,
  whenChanged,
  telephoneNumber,

[Code] .....

How can I modify the hardcoded date (''20130101000000.0Z'') to check against current_date - 7 days?

View 7 Replies View Related

Reporting Services :: Pass A Parameter To LDAP Query In SSRS

Aug 20, 2015

Is it possible to use a parameter in a ldap query using the ADsDSOObject provider?  I keep getting an error "The ICommandWithParameters interface is not supported by the "ADSDSOObject" provider".  Command parameters are unsupported with the current provider.

I don't have a linked server on my DB server to Active Directory so I'm just querying in the SSRS report design.  Here is my query for my dataset.  If I hard code an example it works.  Just doesn't work when I pass a parameter. I've tried making it an expression (= sign), Tried several syntax's, Tried everything I can think of.  Is this possible? or do I just need to push for a linked server?

="SELECT sAMAccountName, displayName, distinguishedName " +
"FROM 'LDAP://DC=xxxx,DC=xx,DC=xx,DC=xx,DC=xx,DC=xx' " +
"WHERE objectCategory = 'Person' " +
"AND objectClass = 'user' " +
"AND memberOf = '" + @GlobalGroup + "'"

View 3 Replies View Related

Hide Cube Attriute Members Value In MDX Query For Report Parameter

Mar 4, 2008

Hi All,

how do i hide an attributes member value in all the reports where my cube is exposed as data source.
Example : Lets say i have dimension called Product.
Product

Name column Key column
Product A 0
Product B 1
Product C 2

Now i need to create mdx query which will fetch member values except 0 key column value so that member values except 0 Key would be loaded in the parameter list. What is the best query so that i will run in to any performance issues. Is there any cube level setting i can do so that i will be doing one time job ?


Can i use Key() function to compare something like Key([Product].[Product Name]) >0 in the mdx query
ot would Except() function would help?


Thanks in advance

View 1 Replies View Related

Simple MDX Query: Multiple Non-Contiguous Members From Same Dimension In Calculated Member

May 28, 2008

Hi

A very basic MDX question. Using the following from AdventureWorks as an example:




Code Snippet
WITH MEMBER [Measures].[Big Cities]
AS
(
[Geography].[City].&[New York]&[NY]
, [Measures].[Internet Order Count]
)
SELECT
[Measures].[Big Cities] ON COLUMNS
, [Customer].[Total Children].Children ON ROWS
FROM [Adventure Works]


How would I re-write the [Measures].[Big Cities] calculated member so it included both [Geography].[City].&[New York]&[NY] and [Geography].[City].&[Los Angeles]&[CA]? Assuming there is no logical connection between these members, and that they are non-contiguous. Also, in my real example, I cannot move [Measures].[Internet Order Count] to the WHERE clause, it must remain within the calculated member.

Thanks,

Julia.

View 9 Replies View Related

Analysis :: Calculate Members At Certain Level In One Hierarchy As Sum Of Corresponding Members At A Certain Level

Jun 4, 2015

Problem setting is a geography dimension with multiple user defined hierarchies in SSAS 2008. 

Ex.: 
Hierarchy 1 (political territory): level 6 --> level 5 --> level 4 --> level 3 (state) --> level 2 --> level 1
Hierarchy 2 (sales territory): level 4 --> level 3 --> level 2 (sales region) --> level 1
...
Hierarchy 9

The relationship between state and sales region is n:1, i.e. one state belongs to exactly one sales region, and one sales region can consists of one or multiple states.  Unfortunatly I can't define this attribute relationsship in the dimension because it would lead to a diamond-shaped relationsship without a user-defined-hierarchy to back it up. So far that isn't much of a problem, user don't drill down from sales region to state. But now I want to define a calculated member that multiplies a measure from the main measure group with another measure from a weighting factor measure group at the state level and above. The granularity attribute of the geography dimension in the dimension usage tab of the weighting factor measuregroup is the state. 

So far what I've got is:

CREATE MEMBER Currentcube.Measures.[weighted measure state and above] AS NULL;
SCOPE (Measures.[weighted measure state and above],
Descendants(geography.[political territory].[all member],3,SELF_AND_BEFORE),
Descendants(geography.[salesterritory].[all member],2,SELF_AND_BEFORE),
... Descendants(geography.[hierarchy 9].[all member],1,SELF_AND_BEFORE)); this = sum(existing(geography.[political territory].state.members), measures.[main measure group measure] * measures.[weighting measure group measure]);END SCOPE;

This works from a functional point of view, but is rather slow when querying any other hierarchy than the political territory hierarchy, because SSAS first goes down from the state level to the key attribute of the geography dimension, and then aggregates from there to the sales region.In other words, I want SSAS to resolve the relationsship (which state belongs to which sales region) through the dimension, and not through the fact, and apply the calculation afterwards. Like some kind of currency conversion, but only from a certain level upwards.

View 5 Replies View Related

Active Directory/ADSI Connection Problems...help!

Mar 15, 2006

I am having weird problems using ADSI and SQL Server. Our local intranet is ASP with a SQL database on Windows 2003 Server. It uses Active Directory (via ADSI linked server) to get authenicate users, etc.

Every now and then (about once a month) the SQL connection to AD will "crash". The following error is what I see when it has crashed:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandText::Execute returned 0x80040e37].

Sometimes it will come back on its own later, others are solved by a server reboot. Here is how my SQL query looks:

SELECT adspath
FROM OPENQUERY(ADSI,
'<LDAP://DC=servername,DC=net>;(&(objectCategory=Person)(objectClass=user));adspath;subtree')
Rowset_1
WHERE (sn <> '')Where can I start to get to the bottom of this?

View 16 Replies View Related

SQL Server 2012 :: Obtaining A Comma Delimited List For Each Group In The Output Of A Group By Query?

Jan 10, 2014

I'd like to ask how you would get the OUTPUT below from the TABLE below:

TABLE:
id category
1 A
2 C
3 A
4 A
5 B
6 C
7 B

OUTPUT:

category count id's
A 3 1,3,4
B 2 5,7
C 2 2,6

The code would go something like:

Select category, count(*), .... as id's
from TABLE
group by category

I just need to find that .... part.

View 3 Replies View Related

Exclude NULL-Values Directly From ADSI-SELECT

Jun 28, 2007

Hi all,



is it possible to exclude empty records from an ADSI QuerySelect?



I got a query like




Code SnippetSELECT objectGUID FROM OpenQuery(ADSI, 'SELECT objectGUID FROM ''LDAP://DC=whatever,DC=domain,DC=org'' where objectClass = ''User'' AND objectCategory = ''Person''')



and would like to have it like




Code Snippet

SELECT objectGUID FROM OpenQuery(ADSI, 'SELECT objectGUID FROM ''LDAP://DC=whatever,DC=domain,DC=org'' where objectClass = ''User'' AND objectCategory = ''Person'' AND homeDirectory IS NOT NULL')

or


Code SnippetSELECT objectGUID FROM OpenQuery(ADSI, 'SELECT objectGUID FROM ''LDAP://DC=whatever,DC=domain,DC=org'' where objectClass = ''User'' AND objectCategory = ''Person'' AND NOT(homeDirectory = NULL) ')



The problem is that I can only perform a query like




Code SnippetSELECT objectGUID FROM OpenQuery(ADSI, 'SELECT objectGUID FROM ''LDAP://DC=whatever,DC=domain,DC=org'' where objectClass = ''User'' AND objectCategory = ''Person'' AND NOT(homeDirectory = '''')')



which results in the error

"Could not fetch a row from OLE DB provider 'ADSDSOObject'."



There are many objects which do have a homedirectory, though, and therefore should be fetched.



Any comments or hints on where my error hides?



I know I could go on fetching all objects and exclude the unwanted ones later on but I'd simply run into the limitation of data records LDAP would provide me with.

Thanks in advance!



Regards,

caracol

View 2 Replies View Related

LDAP With Parameter

Dec 19, 2006

Dear Friends,
Here I have 2 stored procedure to return data via LDAP from Active Directory. The first SP it's OK, but the second doesn't.
The difference is in ''@MyDIR'' because in the second I want to use a paramter... How can I use a paramter in the second SP?
THANKS

1.
CREATE PROCEDURE [dbo].[GD_SP_LDAP_CGD_GET_CNsByDIR]
@MyDIR nvarchar(20)
AS

DECLARE @SQLString NVARCHAR(500);
SET @MyDIR ='DSO'

SET @SQLString = N'SELECT * FROM OPENQUERY(ADSI,''
SELECT name
FROM ''''LDAP://OU=DSO,OU=Estacoes,OU=Servicos-Centrais,OU=cgd,DC=GrupoCGD,DC=com''''
'')';

EXECUTE sp_executesql @SQLString;



2.
CREATE PROCEDURE [dbo].[GD_SP_LDAP_CGD_GET_CNsByDIR]
@MyDIR nvarchar(20)
AS

DECLARE @SQLString NVARCHAR(500);
SET @MyDIR ='DSO'

SET @SQLString = N'SELECT * FROM OPENQUERY(ADSI,''
SELECT name
FROM ''''LDAP://OU='' @MyDIR '' ,OU=Estacoes,OU=Servicos-Centrais,OU=cgd,DC=GrupoCGD,DC=com''''
'')';

EXECUTE sp_executesql @SQLString;

View 1 Replies View Related

Site Server, LDAP

Oct 2, 2000

Hi,
can anyone tell me how exactly sql server7 interacts with Site Server, LDAP.
I am a sql dba, trying to work with above ones. Anyone pls suggest me any book or material or ur ideas.

Thanks!

--Siva

View 1 Replies View Related

LDAP Data Source

Oct 12, 2007

Hi

I need to export data from an LDAP-compliant data source, to a SQL Server database. Is this possible with SQL Server 2005 Integration Services? The Import and Export Wizard
does not appear to support LDAP in the Data Source drop down list.

Thanks

Alan

View 4 Replies View Related

LDAP Data Source

Oct 12, 2007

Hi


I need to export data from an LDAP-compliant data source, to a SQL Server database. Is this possible with SQL Server 2005 Integration Services? The Import and Export Wizard does not appear to support LDAP in the Data Source drop down list.

Thanks

Alan

View 8 Replies View Related

SQL 2012 :: How To Connect To Server Via LDAP

May 6, 2015

I have very unusual question. I have seen a query that looks something like this:

SELECT A, B, C FROM 'LDAP://abc.def.com'

What exactly does this mean? Could such a query be executed in the SQL Server Management Studio? Where would such a table/database be actually located?

View 3 Replies View Related

LDAP Authentication For Yellowfin On SQLserver

Mar 27, 2006

Hi,- SQLserver 2000- Yellowfin 2.4- Windows 2003 serverI have been asked to investigate seting up LDAP authentication toaccess ourYellowfin reporting.If anyone has experience in setting this up? Your help would beappreciated.Tips and tricks .. ??ThanksDuncan Beaumont

View 2 Replies View Related

Linked Server To Third Party LDAP

Apr 14, 2006

I thought I was successful in linking SQL to a Third Party LDAP in the past, but I cannot get it to work now. It has been about 2 years ago I played with this. The LDAP does require authentication and I think that is where the problem lies, but if anyone can tell me if there is a way to do this and what the steps are I would greatly appreciate it.

View 2 Replies View Related

Connect To A Novell NDS Datasoource Via LDAP

Feb 5, 2007

Hi All,

Is there a connector in Connections Manager that can access a Novell NDS tree and help to pull data in an SSIS package?

Thanks,

BIG S

View 7 Replies View Related

Remote Database Management Through LDAP Tools

Aug 31, 2006

Hai All

How to insert and delete records from a table in the remote database?"

I want it to be done through a tool that used LDAP Servers.

I want tools for the LDAP .



Thank u Advance

Regards
Sunil
aboutknowledge@gmail.com

View 2 Replies View Related

Writing Data From The Integration Services To A SUN LDAP

Oct 29, 2007

Hi All,

I currently have the problem that I have to write some data into a SUN Directory Server 5.2 LDAP directory.
Does anyone know how I can do this. I already found some articles in this forum that provide solutions how to access
the active directory - but how can I access a none Microsoft LDAP Server?

Is there any way to use the OLE DB Destination or do I have to implement my own LDAP adapter in VB.net?

Thanks a lot for help.

View 1 Replies View Related

Authenticating Against LDAP/Active Directory With SQL Server 2000 SP2

Jun 4, 2007

Hello everyone,

We have a custom application that connects remotely to a SQL Server 2000 (SP2) database. We would like our application to validate a user's login against Active Directory.

So far I have been able to get a lookup working, but I can not find documentation on how to validate the password from within SQL Server. I found a lot of notes on using ASP.NET objects, or VB, C#, etc, but for this solution it must be done entirely in SQL. It would also be nice if this were SQL Server 2005; we could just embed the C# code and call it as a SQL stored proc, but unfortunately we are left with the constraint that we cannot upgrade this DB at this time.


Linked server 'ADSI' is set up with the sp_addlinkedserver command:

EXEC master.dbo.sp_addlinkedserver @server = N'ADSI', @srvproduct=N'Active
Directory Services 2.5', @provider=N'ADsDSOObject', @datasrc=N'adsdatasource'


Two table functions in our test DB (trying to test both ways I've found in docs):

ALTER FUNCTION [dbo].[GetAuthenticatedUserViaLDAP]
(
-- Add the parameters for the function here
@userId nvarchar(50),
@password nvarchar(50)
)
RETURNS TABLE
AS
RETURN
(
-- Add the SELECT statement with parameter references here
SELECT [SAMAccountName], CN [Name], SN [Last Name], ST State
FROM OPENQUERY( ADSI,
'<LDAP://DC=company,DC=com>;((objectClass=user));SAMAccountName,cn,sn,st')
WHERE [SAMAccountName] = @userId
)

ALTER FUNCTION [dbo].[GetAuthenticatedUser]
(
-- Add the parameters for the function here
@userId nvarchar(50),
@password nvarchar(50)
)
RETURNS TABLE
AS
RETURN
(
-- Add the SELECT statement with parameter references here
SELECT [SAMAccountName], [Name], SN [Last Name], ST State
FROM OPENQUERY( ADSI,
'SELECT SAMAccountName, Name, SN, ST
FROM ''LDAP://bdsserver1/ CN=users,DC=company,DC=com''
WHERE objectCategory = ''Person''
AND objectClass = ''user'' ')
WHERE [SAMAccountName] = @userId
)


So calling either of these table functions from our custom application gives the same result:

select * from dbo.GetAuthenticatedUser('astonaker','abc')
OR
select * from dbo.GetAuthenticatedUserViaLDAP('astonaker','abc')


ResultSet:

'astonaker', 'Anthony', 'Stonaker' 'NULL'


So I can at least tell if a given user exists or not, but I have no visibility into whether the password they entered into our application is valid in LDAP.

I don't want to pass unencrypted passwords through the network, but then I don't know how to encrypt/compare these passwords without using the .NET Connection or DirectoryEntry, etc objects.

Any thoughts/suggestions are greatly appreciated!

View 5 Replies View Related

Reporting Services :: Display Group Name Value Of Each Group In Column Header Outside The Group?

Sep 29, 2015

I have an SSRS 2012 table report with groups; each group is broken ie. one group for one page, and there are multiple groups in multiple pages.

'GroupName' column has multiple values - X,Y,Z,......

I need to group 'GroupName' with X,Y,Z,..... ie value X in page 1,value Y in page 2, value Z in page 3...

Now, I need to display another column (ABC) in this table report (outside the group column 'GroupName'); this outside column itself is another column header (not a group header) in the table (report) and it derives its name partly from the 'GroupName'  values:

Example:

Value X for GroupName in page 1 will mean, in page 1, column Name of ABC column must be ABC-X Value Y for GroupName in page 2 will mean, in page 2, column Name of ABC column must be ABC-Y Value Z for GroupName in page 3 will mean, in page 3, column Name of
ABC column must be ABC-Z

ie the column name of ABC (Clm ABC)  must be dynamic as per the GroupName values (X,Y,Z....)

Page1:

GroupName                 Clm ABC-X

X

Page2:

GroupName                 Clm ABC-Y

Y

Page3:

GroupName                 Clm ABC-Z

Z

I have been able to use First(ReportItems!GroupName.Value) in the Page Header to get GroupNames displayed in each page; I get X in page 1, Y in page 2, Z in page 3.....

However, when I use ReportItems (that refers to a group name) in the Report Body outside the group,

I get the following error:

Report item expressions can only refer to other report items within the same grouping scope or a containing grouping scope

I need to get the X, Y, Z ... in each page for the column ABC.

I have been able to use this - First(Fields!GroupName.Value); however, I get ABC-X, ABC-X, ABC-X in each of the pages for the ABC column, instead of ABC-X in page 1, ABC-Y in page 2, ABC-Z in page 3, ...

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved