People Picker 处理过程

SharePoint的用户和组的页面中可以为站点添加用户. 放入一个关键字, 就可以对域中的用户进行搜索, 确认后的用户会显示出用户的display name, 并会加下划线. 那么People Picker是如何工作的呢?

 

1. People会去查询SharePoint的Content Database, 查询方式是运行一个SQL语句:

EXEC Sp_executesql

N'

SELECT TOP 202 t1.[Type]     AS c0,

               t1.[MetaInfo] AS c2,

               userdata.[nvarchar3],

               userdata.[tp_ContentTypeId],

               userdata.[nvarchar8],

               userdata.[tp_ID],

               userdata.[tp_CopySource],

               userdata.[tp_Version],

               userdata.[nvarchar4],

               t1.[ScopeId]  AS c4,

               userdata.[nvarchar9],

               userdata.[nvarchar5],

               userdata.[tp_Created],

               CASE

                 WHEN Datalength(t1.dirname) = 0 THEN t1.leafname

                 WHEN Datalength(t1.leafname) = 0 THEN t1.dirname

                 ELSE t1.dirname + N'' / '' + t1.leafname

               END           AS c1,

               userdata.[tp_HasCopyDestinations],

               userdata.[nvarchar1],

               userdata.[tp_ModerationStatus],

               userdata.[tp_Level],

               t1.[Id]       AS c3,

               userdata.[tp_ContentType]

FROM   userdata

       INNER MERGE JOIN docs AS t1 WITH(nolock)

         ON ( 1 = 1

              AND userdata.[tp_RowOrdinal] = 0

              AND t1.siteid = userdata.tp_siteid

              AND t1.siteid = @L2

              AND t1.dirname = userdata.tp_dirname

              AND t1.leafname = userdata.tp_leafname

              AND t1.LEVEL = userdata.tp_level

              AND t1.iscurrentversion = 1

              AND ( 1 = 1 ) )

WHERE  ( userdata.tp_iscurrent = 1 )

       AND userdata.tp_siteid = @L2

       AND ( userdata.tp_dirname = @DN )

       AND userdata.tp_rowordinal = 0

       AND ( ( userdata.[bit3] = 0 )

             AND ( ( ( userdata.[nvarchar3] LIKE @L3TXP )

                      OR ( userdata.[nvarchar1] LIKE @L4TXP ) )

                    OR ( userdata.[nvarchar4] LIKE @L4TXP ) )

             AND t1.siteid = @L2

             AND ( t1.dirname = @DN ) )

ORDER  BY t1.[Type] DESC,

          userdata.[nvarchar3] ASC,

          userdata.[tp_ID] ASC

OPTION (FORCE ORDER)

,

N'@L0 uniqueidentifier,@L2 uniqueidentifier,@L3TXP nvarchar(255),@L4TXP nvarchar(255),@DN nvarchar(260)',

@L0='00000000-0000-0000-0000-000000000000',

@L2='48D3807B-XXXX-XXXX-XXXX-EE6030973575',

@L3TXP=N'%KeyWord%',

@L4TXP=N'KeyWord%',

@DN=N'_catalogs/users'

 

注意这里的L3XP, 在输入的KeyWord前后都有通配符, nvarchar3中存储的是login name, 所以如果你输入的keywords是login name的任一部分都可以从content database中得到搜索结果.

L4XP只在关键字的后面跟了一个通配符, 所以你搜索的关键字必须是nvarchar1或nvarchar4中的字段的开始的部分, 根据其中的内容推断, 这两个字段一个是displayname, 一个是邮件地址.

 

2. 如果在content database中没有找到, 说明站点中以前并没有添加过这个用户, people picker这时会去查询Domain Controller, 运行LDAP查询, 获取AD返回回来的用户实例.

3. 如果这时用network monitor抓取网络包, 用LDAP协议作filter, 你就会看到LDAP query的filter以及向AD所要的属性列表还有AD返回的属性列表.

你可能感兴趣的:(处理)