Esempio n. 1
0
        public static bool IsADomainAccount(string userAccount)
        {
            if (String.IsNullOrEmpty(userAccount))
            {
                return(false);
            }

            return(IsADomainAccount(UserAccountHelper.GetNTAccountFromName(userAccount)));
        }
Esempio n. 2
0
        public static bool IsRoleFor(SecurityIdentifier adminGroupSID, string accountName)
        {
            SecurityIdentifier sid = null;

            if (UserAccountHelper.IsADomainAccount(accountName))
            {
                NTAccount ntAccount = UserAccountHelper.GetNTAccountFromName(accountName);
                sid = Translate <NTAccount, SecurityIdentifier>(ntAccount);
                if (sid == null)
                {
                    sid = new SecurityIdentifier(ntAccount.Value);
                }

                return(AuthzAccessCheck(adminGroupSID, sid));
            }

            // Ignore the check for non-domain accounts.
            return(true);
        }