WSS 数据库表中的 UserInfo 表中的 tp_SystemId 字段的使用
生活随笔
收集整理的這篇文章主要介紹了
WSS 数据库表中的 UserInfo 表中的 tp_SystemId 字段的使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在 WSS 的數據庫中,UserInfo表的?tp_SystemId?記錄的是用戶登錄驗證時需要用到的數據,是此用戶在 AD( Active Directory ) 中的?SID( Security ID )。此字段的數據很重要,不小心改動的話,此用戶將不能登錄 WSS。
這里介紹一下如何修復?tp_SystemID?字段。
假設不能登錄的用戶叫?nt_user( UserInfo表中的 tp_Login 字段的值應該為 <Domain>\nt_user?)。
???DirectoryEntry?userEntry?=?null;
???DirectoryEntry?dirEntry?=?new?DirectoryEntry(?stPath?);
???//?Create?a?DirectorySearcher?object
???DirectorySearcher?searcher?=?new?DirectorySearcher(?dirEntry?);
???searcher.SearchScope?=?SearchScope.Subtree;
???searcher.Filter?=?stFilter;
???searcher.PropertiesToLoad.Add(?"objectSID"?);
???//?Analyse?the?results
???SearchResultCollection?results?=?searcher.FindAll();
???Console.WriteLine(?"Search?result?count:?{0}",?results.Count?);
???if(?results.Count>0?)
???{
??????userEntry?=?results[0].GetDirectoryEntry();
???}
???else
???{
??????//?Can?not?find?the?user.
???}
用戶的 SID 值可以用 objectSID 屬性獲取。 byte?[]?sid?=?userEntry.Properties["objectSID"].Value?as?byte[];
????string?stSID?=?BytesToHexString(?sid?);
????public?static?string?BytesToHexString(?byte?[]?bytes?)
????{
????????System.Text.StringBuilder?hexString?=?new?System.Text.StringBuilder();
????????for(?int?counter=0;?counter<bytes.Length;?counter++?)
????????????hexString.AppendFormat(?"{0:x2}",?bytes[counter]?);
????}
打開查詢分析器或自己寫程序可以直接更新 WSS 數據庫表 UserInfo 的 tp_SystemID 字段的值。
總結
以上是生活随笔為你收集整理的WSS 数据库表中的 UserInfo 表中的 tp_SystemId 字段的使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 第十节: 利用SQLServer实现Qu
- 下一篇: 宁德时代麒麟电池来了!即将发布:比特斯拉