Esempio n. 1
0
        /// <summary>
        /// Creates a system wide Disable Sharing policy.
        /// </summary>
        /// <param name="domainID">Domain that the interval will be associated with.</param>
        /// <param name="status">value of the disable sharing enumerator</param>
        static public void Create(string domainID, int status)
        {
            // Need a policy manager.
            PolicyManager pm = new PolicyManager();

            // See if the policy already exists.
            Policy policy = pm.GetPolicy(DisableSharingPolicyID, domainID);

            if ((status >= 0))
            {
                if (policy == null)
                {
                    // The policy does not exist, create a new one and add the rules.
                    policy = new Policy(DisableSharingPolicyID, DisableSharingShortDescription);
                }

                // Add the new value and save the policy.
                policy.AddValue(DisableSharingStatusTag, status);
                pm.CommitPolicy(policy, domainID);
            }
            else if (policy != null)
            {
                // Setting the interval to zero is the same as deleting the policy.
                pm.DeletePolicy(policy);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a system wide sync interval policy.
        /// </summary>
        /// <param name="domainID">Domain that the interval will be associated with.</param>
        /// <param name="interval">Sync interval in seconds that all users in the domain will be set to.</param>
        static public void Create(string domainID, int interval)
        {
            // Need a policy manager.
            PolicyManager pm = new PolicyManager();

            // See if the policy already exists.
            Policy policy = pm.GetPolicy(SyncIntervalPolicyID, domainID);

            if ((interval == InfiniteSyncInterval) || (interval > 0))
            {
                if (policy == null)
                {
                    // The policy does not exist, create a new one and add the rules.
                    policy = new Policy(SyncIntervalPolicyID, SyncIntervalShortDescription);
                }

                // Add the new value and save the policy.
                policy.AddValue(IntervalTag, interval);
                pm.CommitPolicy(policy, domainID);
            }
            else if (policy != null)
            {
                // Setting the interval to zero is the same as deleting the policy.
                pm.DeletePolicy(policy);
            }
        }