本文整理汇总了C#中UserGroup.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# UserGroup.ToString方法的具体用法?C# UserGroup.ToString怎么用?C# UserGroup.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserGroup
的用法示例。
在下文中一共展示了UserGroup.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetGroupName
public static string GetGroupName(UserGroup group)
{
switch (group)
{
case UserGroup.Admin:
return "Administrator";
default:
return group.ToString();
}
}
示例2: UpdateTokenData
private void UpdateTokenData()
{
UserGroup user = _token.User;
txtUsername.Text = user.ToString();
txtUserSid.Text = user.Sid.ToString();
TokenType tokentype = _token.TokenType;
txtTokenType.Text = _token.TokenType.ToString();
if (_token.TokenType== TokenType.Impersonation)
{
SecurityImpersonationLevel implevel = _token.ImpersonationLevel;
txtImpLevel.Text = implevel.ToString();
}
else
{
txtImpLevel.Text = "N/A";
}
txtTokenId.Text = FormatLuid(_token.Id);
txtModifiedId.Text = FormatLuid(_token.ModifiedId);
txtAuthId.Text = FormatLuid(_token.AuthenticationId);
if (Enum.IsDefined(typeof(TokenIntegrityLevel), _token.IntegrityLevel))
{
comboBoxIL.SelectedItem = _token.IntegrityLevel;
comboBoxILForDup.SelectedItem = _token.IntegrityLevel;
}
else
{
comboBoxIL.Text = _token.IntegrityLevel.ToString();
comboBoxILForDup.Text = _token.IntegrityLevel.ToString();
}
txtSessionId.Text = _token.SessionId.ToString();
txtSourceName.Text = _token.Source.SourceName;
txtSourceId.Text = FormatLuid(_token.Source.SourceIdentifier);
TokenElevationType evtype = _token.ElevationType;
txtElevationType.Text = evtype.ToString();
txtIsElevated.Text = _token.Elevated.ToString();
txtOriginLoginId.Text = FormatLuid(_token.Origin);
btnLinkedToken.Enabled = evtype != TokenElevationType.Default;
UpdateGroupList();
txtPrimaryGroup.Text = _token.PrimaryGroup.Name;
txtOwner.Text = _token.Owner.Name;
Acl defdacl = _token.DefaultDalc;
if (!defdacl.NullAcl)
{
foreach (Ace ace in defdacl)
{
UserGroup group = new UserGroup(ace.Sid, GroupAttributes.None);
ListViewItem item = new ListViewItem(group.ToString());
uint mask = (uint)(GenericAccessRights.GenericAll | GenericAccessRights.GenericExecute | GenericAccessRights.GenericRead | GenericAccessRights.GenericWrite);
string maskstr;
if (((uint)ace.Mask & ~mask) != 0)
{
maskstr = String.Format("0x{0:X08}", ace.Mask);
}
else
{
GenericAccessRights generic = (GenericAccessRights)ace.Mask;
maskstr = generic.ToString();
}
item.SubItems.Add(maskstr);
item.SubItems.Add(ace.AceFlags.ToString());
item.SubItems.Add(ace.AceType.ToString());
listViewDefDacl.Items.Add(item);
}
}
else
{
listViewDefDacl.Items.Add("No Default DACL");
}
listViewDefDacl.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
listViewDefDacl.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
if (_token.Restricted)
{
PopulateGroupList(listViewRestrictedSids, _token.RestrictedSids);
}
else
{
tabControlMain.TabPages.Remove(tabPageRestricted);
}
if (_token.AppContainer)
{
PopulateGroupList(listViewCapabilities, _token.Capabilities);
txtACNumber.Text = _token.AppContainerNumber.ToString();
txtPackageSid.Text = _token.AppContainerSid.Name;
//.........这里部分代码省略.........
示例3: CreateListViewGroupItem
private ListViewItem CreateListViewGroupItem(UserGroup item) {
ListViewItem listViewItem = new ListViewItem();
listViewItem.Text = item.ToString();
groupsListView.SmallImageList.Images.Add(item.ItemImage);
listViewItem.ImageIndex = rolesListView.SmallImageList.Images.Count - 1;
listViewItem.Tag = item;
return listViewItem;
}