![](/img/trans.png)
[英]How to make a membership user to the admin of a membership group in Ektron?
[英]How to find if a user has a membership to a specific Global Group in a service?
我似乎無法找到某個用戶是DeployUsersProduction組的成員。 這是我到目前為止的內容:
[OperationBehavior(Impersonation = ImpersonationOption.Required)]
public Modes GetDeployMode()
{
bool isProd = false;
WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent();
if (windowsIdentity == null || windowsIdentity.Groups == null) { return Modes.DUS; }
foreach (IdentityReference identityReference in windowsIdentity.Groups)
{
try
{
var reference = identityReference;
string group = reference.Translate(typeof (NTAccount)).Value.Trim();
if (!String.Equals(group, "DeployUsersProduction", StringComparison.OrdinalIgnoreCase)) { continue; }
isProd = true;
break;
}
catch (Exception ex)
{
// Silent catch due to the [Some or all identity references could not be translated]
// error that sometimes occurs while trying to map an identity.
}
}
return isProd ? Modes.Prod : Modes.DUS;
}
據我所知,我已經正確配置了所有配置,spn,db,perms等。 我只有一個應該返回Modes.Prod的用戶,事實並非如此。
答案不是我的方法是錯誤的,而是我需要在要搜索的組之前為其域添加前綴:
if (!String.Equals(group, @"DOMAIN\DeployUsersProd", StringComparison.OrdinalIgnoreCase)) { continue; }
特別感謝@DJ KRAZE提供的鏈接,這些鏈接使我編寫了自己的控制台應用程序,該應用程序輸出了分組,因此我可以弄清楚!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.