示例#1
0
        internal string GetSddlForm()
        {
            string sidString = Value;

            WellKnownAccount acct = WellKnownAccount.LookupBySid(sidString);

            if (acct == null || acct.SddlForm == null)
            {
                return(sidString);
            }

            return(acct.SddlForm);
        }
示例#2
0
        internal string GetSddlForm()
        {
            string result = ToString();

            WellKnownAccount acct = WellKnownAccount.LookupBySid(result);

            if (acct != null && acct.SddlForm != null)
            {
                result = acct.SddlForm;
            }

            return(result);
        }
示例#3
0
        public override IdentityReference Translate(Type targetType)
        {
            if (targetType == typeof(SecurityIdentifier))
            {
                return(this);
            }

            if (targetType == typeof(NTAccount))
            {
                WellKnownAccount acct = WellKnownAccount.LookupBySid(this.Value);
                if (acct == null || acct.Name == null)
                {
                    throw new IdentityNotMappedException("Unable to map SID: " + this.Value);
                }

                return(new NTAccount(acct.Name));
            }

            throw new ArgumentException("Unknown type.", "targetType");
        }