예제 #1
0
 /// <summary>
 /// Creates a folder for related tasks. Not available to Task Scheduler 1.0.
 /// </summary>
 /// <param name="subFolderName">The name used to identify the folder. If "FolderName\SubFolder1\SubFolder2" is specified, the entire folder tree will be created if the folders do not exist. This parameter can be a relative path to the current <see cref="TaskFolder"/> instance. The root task folder is specified with a backslash (\). An example of a task folder path, under the root task folder, is \MyTaskFolder. The '.' character cannot be used to specify the current task folder and the '..' characters cannot be used to specify the parent task folder in the path.</param>
 /// <param name="folderSecurity">The task security associated with the folder.</param>
 /// <returns>A <see cref="TaskFolder"/> instance that represents the new subfolder.</returns>
 public TaskFolder CreateFolder([NotNull] string subFolderName, [NotNull] TaskSecurity folderSecurity)
 {
     if (folderSecurity == null)
     {
         throw new ArgumentNullException(nameof(folderSecurity));
     }
     return(CreateFolder(subFolderName, folderSecurity.GetSecurityDescriptorSddlForm(Task.defaultAccessControlSections)));
 }
예제 #2
0
 /// <summary>
 /// Applies access control list (ACL) entries described by a <see cref="TaskSecurity"/> object to the file described by the current <see cref="TaskFolder"/> object.
 /// </summary>
 /// <param name="taskSecurity">A <see cref="TaskSecurity"/> object that describes an access control list (ACL) entry to apply to the current folder.</param>
 public void SetAccessControl([NotNull] TaskSecurity taskSecurity)
 {
     taskSecurity.Persist(this);
 }
 internal void Persist(TaskFolder folder, AccessControlSections includeSections = AccessControlSections.Access | AccessControlSections.Group | AccessControlSections.Owner)
 {
     base.WriteLock();
     try
     {
         AccessControlSections accessControlSectionsFromChanges = this.GetAccessControlSectionsFromChanges();
         if (accessControlSectionsFromChanges != AccessControlSections.None)
         {
             folder.SetSecurityDescriptorSddlForm(this.GetSecurityDescriptorSddlForm(includeSections), TaskSecurity.Convert(includeSections));
             base.OwnerModified = base.GroupModified = base.AccessRulesModified = base.AuditRulesModified = false;
         }
     }
     finally
     {
         base.WriteUnlock();
     }
 }
예제 #4
0
        public void Initialize(string displayName, bool isContainer, string targetServer, TaskSecurity taskSecurity)
        {
            var rt = (System.Security.AccessControl.ResourceType) 99;

            init2MI.Invoke(dlg, new object[] { displayName, displayName, isContainer, rt, taskSecurity.GetSecurityDescriptorBinaryForm(), targetServer });
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TaskSecurity" /> class with the specified sections of the access control security rules from the specified task.
 /// </summary>
 /// <param name="folder">The folder.</param>
 /// <param name="sections">The sections of the ACL to retrieve.</param>
 public TaskSecurity(TaskFolder folder, AccessControlSections sections = System.Security.AccessControl.AccessControlSections.Access | System.Security.AccessControl.AccessControlSections.Owner | System.Security.AccessControl.AccessControlSections.Group)
     : base(false)
 {
     this.SetSecurityDescriptorSddlForm(folder.GetSecurityDescriptorSddlForm(TaskSecurity.Convert(sections)));
 }