Esempio n. 1
0
        /// <summary>
        /// Creates a file size filter policy for the specified member.
        /// </summary>
        /// <param name="member">Member that the filter will be associated with.</param>
        /// <param name="limit">Size of file in bytes that all users in the domain will be limited to.</param>
        static public void Create(Member member, long limit)
        {
            ICSList ftList = new ICSList();

            // Need a policy manager.
            PolicyManager pm = new PolicyManager();

            if (limit > 0)
            {
                ftList.Add(new Rule(limit, Rule.Operation.Greater, Rule.Result.Deny));

                pm.CommitPolicy(FileSizeFilterPolicyID, ftList, member);
            }
            else
            {
                pm.DeletePolicy(FileSizeFilterPolicyID, member);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a file type filter policy for the specified member.
        /// </summary>
        /// <param name="member">Member that the filter will be associated with.</param>
        /// <param name="patterns">File type patterns that will be used to filter files.</param>
        static public void Create(Member member, FileTypeEntry[] patterns)
        {
            ICSList ftList = new ICSList();

            // Need a policy manager.
            PolicyManager pm = new PolicyManager();

            if (patterns.Length > 0)
            {
                // Add the new rules and save the policy.
                foreach (FileTypeEntry fte in patterns)
                {
                    ftList.Add(new Rule(fte.Name, fte.IgnoreCase ? Rule.Operation.RegExp_IgnoreCase : Rule.Operation.RegExp, fte.Allowed ? Rule.Result.Allow : Rule.Result.Deny));
                }

                pm.CommitPolicy(FileTypeFilterPolicyID, ftList, member);
            }
            else
            {
                pm.DeletePolicy(FileTypeFilterPolicyID, member);
            }
        }