예제 #1
0
        /// <summary>
        /// Overridden ProcessRecord method.
        /// </summary>
        protected override void ProcessRecord()
        {
            SecurityDescriptor sd = null;

            switch (ParameterSetName)
            {
            case "FromToken":
                sd = new SecurityDescriptor(Token);
                break;

            case "FromSddl":
                sd = new SecurityDescriptor(Sddl);
                break;

            default:
                sd = new SecurityDescriptor
                {
                    Dacl = new Acl()
                };
                sd.Dacl.NullAcl = NullDacl;
                break;
            }

            if (MapType != null)
            {
                sd.MapGenericAccess(MapType);
            }

            WriteObject(sd);
        }
        /// <summary>
        /// Overridden ProcessRecord method.
        /// </summary>
        protected override void ProcessRecord()
        {
            if (MapType && Type == null)
            {
                WriteWarning("Must specify Type for MapType to work correctly.");
            }

            SecurityDescriptor sd = null;

            switch (ParameterSetName)
            {
            case "FromToken":
                sd = new SecurityDescriptor(Token);
                break;

            case "FromSddl":
                sd = new SecurityDescriptor(Sddl);
                break;

            case "FromBytes":
                sd = new SecurityDescriptor(Bytes);
                break;

            case "FromKey":
                sd = new SecurityDescriptor(Key.QueryValue(ValueName).Data);
                break;

            case "FromKeyValue":
                sd = new SecurityDescriptor(KeyValue.Data);
                break;

            default:
                sd = new SecurityDescriptor
                {
                    Dacl = new Acl()
                };
                sd.Dacl.NullAcl = NullDacl;
                break;
            }

            sd.NtType = Type;
            if (MapType)
            {
                sd.MapGenericAccess();
            }
            sd.Control |= Control;

            WriteObject(sd);
        }