Beispiel #1
0
        internal override bool AccessCheck(Principal p, PrincipalAccessMask targetPermission)
        {
            GlobalDebug.WriteLineIf(GlobalDebug.Info, "SAMStoreCtx", "AccessCheck " + targetPermission.ToString());

            switch (targetPermission)
            {
            case PrincipalAccessMask.ChangePassword:

                PropertyValueCollection values = ((DirectoryEntry)p.GetUnderlyingObject()).Properties["UserFlags"];

                if (values.Count != 0)
                {
                    Debug.Assert(values.Count == 1);
                    Debug.Assert(values[0] is int);

                    return(SDSUtils.StatusFromAccountControl((int)values[0], PropertyNames.PwdInfoCannotChangePassword));
                }

                Debug.Fail("SAMStoreCtx.AccessCheck:  user entry has an empty UserFlags value");

                GlobalDebug.WriteLineIf(GlobalDebug.Info, "SAMStoreCtx", "AccessCheck Unable to read userAccountControl");

                break;

            default:

                Debug.Fail("SAMStoreCtx.AccessCheck: Fell off end looking for " + targetPermission.ToString());

                break;
            }

            return(false);
        }