internal CommonAccessCheckResult CreateResult(AccessMask granted_access, TokenInformation token_info) { if (Folder) { return(new CommonAccessCheckResult(Path, "Scheduled Task", granted_access, _file_type.GenericMapping, SecurityDescriptor.Clone(), typeof(FileDirectoryAccessRights), true, token_info)); } else { return(new ScheduledTaskAccessCheckResult(this, granted_access, SecurityDescriptor.Clone(), _file_type.GenericMapping, token_info)); } }
/// <summary> /// Process Record. /// </summary> protected override void ProcessRecord() { Action <Acl, Predicate <Ace> > selector; if (First) { selector = (a, p) => a.Find(p); } else { selector = (a, p) => a.FindAll(p); } if (AsSecurityDescriptor) { var acl_type = AclType; SecurityDescriptor sd = SecurityDescriptor.Clone(); sd.Dacl = null; sd.Sacl = null; if (acl_type.HasFlag(SecurityDescriptorAclType.Dacl)) { AclType = SecurityDescriptorAclType.Dacl; sd.Dacl = new Acl(SelectAces(selector)); } if (acl_type.HasFlag(SecurityDescriptorAclType.Sacl)) { AclType = SecurityDescriptorAclType.Sacl; sd.Sacl = new Acl(SelectAces(selector)); } AclType = acl_type; WriteObject(sd); } else { WriteObject(SelectAces(selector), true); } }