WSS 数据库表中的 UserInfo 表中的 tp_SystemId 字段的使用
生活随笔
收集整理的這篇文章主要介紹了
WSS 数据库表中的 UserInfo 表中的 tp_SystemId 字段的使用
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
在 WSS 的數(shù)據(jù)庫(kù)中,UserInfo表的?tp_SystemId?記錄的是用戶(hù)登錄驗(yàn)證時(shí)需要用到的數(shù)據(jù),是此用戶(hù)在 AD( Active Directory ) 中的?SID( Security ID )。此字段的數(shù)據(jù)很重要,不小心改動(dòng)的話(huà),此用戶(hù)將不能登錄 WSS。
這里介紹一下如何修復(fù)?tp_SystemID?字段。
假設(shè)不能登錄的用戶(hù)叫?nt_user( UserInfo表中的 tp_Login 字段的值應(yīng)該為 <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.
???}
用戶(hù)的 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]?);
????}
打開(kāi)查詢(xún)分析器或自己寫(xiě)程序可以直接更新 WSS 數(shù)據(jù)庫(kù)表 UserInfo 的 tp_SystemID 字段的值。
總結(jié)
以上是生活随笔為你收集整理的WSS 数据库表中的 UserInfo 表中的 tp_SystemId 字段的使用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 第十节: 利用SQLServer实现Qu
- 下一篇: linux cmake编译源码,linu