日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪(fǎng)問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > 数据库 >内容正文

数据库

WSS 数据库表中的 UserInfo 表中的 tp_SystemId 字段的使用

發(fā)布時(shí)間:2023/12/10 数据库 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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?)。

  • 在 AD 中找到此用戶(hù) ???string?stPath?=?"LDAP://"?+?System.Environment.UserDomainName; ???? string?stFilter?=?"(&(sAMAccountname=nt_user)(objectclass=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 值
    用戶(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]?);
    ????}
  • 更新 UserInfo 表
    打開(kāi)查詢(xún)分析器或自己寫(xiě)程序可以直接更新 WSS 數(shù)據(jù)庫(kù)表 UserInfo 的 tp_SystemID 字段的值。
  • 在瀏覽器中再次訪(fǎng)問(wèn) WSS 網(wǎng)站,用戶(hù)就可以成功登錄了!
  • 總結(jié)

    以上是生活随笔為你收集整理的WSS 数据库表中的 UserInfo 表中的 tp_SystemId 字段的使用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。