public static void ApplyPolicy() { Queue <Policy> temp = new Queue <Policy>(); if (policyNames != null && policyNames.Count() > 0) { foreach (Policy current in policyNames) { if (current.counter > current.duration - 1) { temp.Enqueue(current); } else { current.counter += 1; current.InstantEffect(); Debug.Log(current.guiName + " has been activated. Counter: " + current.counter + "/" + current.duration); } } } if (temp.Count > 0) { foreach (Policy current in temp) { current.ResetPolicy(); PolicyManager.RemovePolicy(current); } } }
/// <summary> /// Gets the sync interval associated with the current user on the current machine. /// </summary> /// <returns>The sync interval that the current user is limited to.</returns> static public int GetInterval() { PolicyManager pm = new PolicyManager(); Policy policy = pm.GetPolicy(SyncIntervalPolicyID); return((policy != null) ? ( int )policy.GetValue(IntervalTag) : 0); }
/// <summary> /// Creates a iFolder level Disable Sharing policy. /// </summary> /// <param name="collection">collection that the interval will be associated with.</param> /// <param name="status">value of the Disable Sharing enumerator</param> static public void Create(Collection collection, int status) { // Need a policy manager. PolicyManager pm = new PolicyManager(); // See if the policy already exists. Policy policy = pm.GetPolicy(DisableSharingPolicyID, collection); 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, collection); } else if (policy != null) { // Setting the interval to zero is the same as deleting the policy. pm.DeletePolicy(policy); } }
/// <summary> /// Creates a sync interval policy for the specified collection. /// </summary> /// <param name="collection">Collection that the filter 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(Collection collection, int interval) { // Need a policy manager. PolicyManager pm = new PolicyManager(); // See if the policy already exists. Policy policy = pm.GetPolicy(SyncIntervalPolicyID, collection); 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, collection); } else if (policy != null) { // Setting the interval to zero is the same as deleting the policy. pm.DeletePolicy(policy); } }
/// <summary> /// Deletes a sync interval policy for the specified member. /// </summary> /// <param name="member">Member that the filter will be associated with.</param> static public void Delete(Member member) { // Need a policy manager. PolicyManager pm = new PolicyManager(); pm.DeletePolicy(SyncIntervalPolicyID, member); }
/// <summary> /// Deletes a file type filter policy for the specified member. /// </summary> /// <param name="member">Member that the filter will be associated with.</param> static public void Delete(Member member) { // Need a policy manager. PolicyManager pm = new PolicyManager(); pm.DeletePolicy(FileTypeFilterPolicyID, member); }
/// <summary> /// Creates a file size filter policy for the current user on the current machine. /// </summary> /// <param name="limit">Size of file in bytes that all users in the domain will be limited to.</param> static public void Create(long limit) { // Need a policy manager. PolicyManager pm = new PolicyManager(); // See if the policy already exists. Policy policy = pm.GetPolicy(FileSizeFilterPolicyID); if (limit > 0) { if (policy == null) { // The policy does not exist, create a new one and add the rules. policy = new Policy(FileSizeFilterPolicyID, FileSizeFilterShortDescription); } else { // The policy already exists, delete the old rules. policy.DeleteRule(FileSizeFilter.GetRule(policy)); } // Add the new rules and save the policy. policy.AddRule(new Rule(limit, Rule.Operation.Greater, Rule.Result.Deny)); pm.CommitLocalMachinePolicy(policy); } else if (policy != null) { // Setting the limit to zero is the same as deleting the policy. pm.DeletePolicy(policy); } }
/// <summary> /// Deletes a disk space quota policy for the specified member. /// </summary> /// <param name="member">Member that the limit will be associated with.</param> static public void Delete(Member member) { // Need a policy manager. PolicyManager pm = new PolicyManager(); pm.DeletePolicy(DiskSpaceQuotaPolicyID, member); }
/// <summary> /// Gets the disk space quota limit associated with the specified domain. /// </summary> /// <param name="domainID">Domain that the limit is associated with.</param> /// <returns>Amount of disk space that all users in the domain are limited to.</returns> static public long GetLimit(string domainID) { PolicyManager pm = new PolicyManager(); Policy policy = pm.GetPolicy(DiskSpaceQuotaPolicyID, domainID); return((policy != null) ? ( long )GetRule(policy).Operand : -1); }
/// <summary> /// Initializes a new instance of an object. /// </summary> /// <param name="member">Member that this file size filter is associated with.</param> private iFolderLimit(Member member) { PolicyManager pm = new PolicyManager(); this.memberPolicy = pm.GetAggregatePolicy(iFolderLimitPolicyID, member); this.limit = GetUserAggregateLimit(memberPolicy); }
/// <summary> /// Creates a disk space quota policy for the specified collection. /// </summary> /// <param name="collection">Collection that the limit will be associated with.</param> /// <param name="limit">Amount of disk space that this collection will be limited to.</param> static public void Create(Collection collection, long limit) { // Need a policy manager. PolicyManager pm = new PolicyManager(); // See if the policy already exists. Policy policy = pm.GetPolicy(DiskSpaceQuotaPolicyID, collection); if (limit >= 0) { if (policy == null) { // The quota policy does not exist, create a new one and add the rule. policy = new Policy(DiskSpaceQuotaPolicyID, DiskSpaceQuotaShortDescription); } else { // The policy already exists, delete the old rule. policy.DeleteRule(DiskSpaceQuota.GetRule(policy)); } // Add the new rule and save the policy. policy.AddRule(new Rule(limit, Rule.Operation.Greater, Rule.Result.Deny)); pm.CommitPolicy(policy, collection); } else if (policy != null) { // Setting the limit to zero is the same as deleting the policy. pm.DeletePolicy(policy); } }
/// <summary> /// Gets the iFolderLimit associated with the current user on the current machine. /// </summary> /// <returns>No of ifolders that all users in the domain are limited to.</returns> static public long GetLimit() { PolicyManager pm = new PolicyManager(); Policy policy = pm.GetPolicy(iFolderLimitPolicyID); return((policy != null) ? ( long )GetRule(policy).Operand : -1); }
/// <summary> /// Function to Delete given member. /// </summary> /// <param name="member">member for which status need to be retrived.</param> /// <returns></returns> static public int GetStatus(Member member) { PolicyManager pm = new PolicyManager(); Policy policy = pm.GetPolicy(EncryptionStatePolicyID, member); return((policy != null) ? (int)policy.GetValue(StatusTag) : 0); }
/// <summary> /// Gets the interval associated with the specified domain. /// </summary> /// <param name="domainID">Domain that the interval is associated with.</param> /// <returns>The sync interval that all users in the domain are limited to.</returns> static public int GetStatus(string domainID) { PolicyManager pm = new PolicyManager(); Policy policy = pm.GetPolicy(EncryptionStatePolicyID, domainID); return((policy != null) ? ( int )policy.GetValue(StatusTag) : 0); }
/// <summary> /// Gets the status of Disable sharing associated with the specified member. /// </summary> /// <param name="member">member for whom policy is sought</param> /// <returns>the status of Disable Sharing as an int</returns> static public int GetStatus(Member member) { PolicyManager pm = new PolicyManager(); Policy policy = pm.GetPolicy(DisableSharingPolicyID, member); return((policy != null) ? (int)policy.GetValue(DisableSharingStatusTag) : 0); }
/// <summary> /// Gets the disk space quota limit associated with the specified member. /// </summary> /// <param name="member">Member that the limit is associated with.</param> /// <returns>Amount of disk space that the member is limited to.</returns> static public long GetLimit(Member member) { PolicyManager pm = new PolicyManager(); Policy policy = pm.GetPolicy(DiskSpaceQuotaPolicyID, member); return((policy != null) ? ( long )GetUserRule(policy).Operand : -1); }
/// <summary> /// Gets the status of Disable sharing associated with the specified collection. /// </summary> /// <param name="collection">collection for which policy is sought</param> /// <returns>the status of Disable Sharing as an int</returns> static public int GetStatus(Collection collection) { PolicyManager pm = new PolicyManager(); Policy policy = pm.GetPolicy(DisableSharingPolicyID, collection); return((policy != null) ? (int)policy.GetValue(DisableSharingStatusTag) : 0); }
/// <summary> /// Gets the disk space quota limit associated with the specified collection. /// </summary> /// <param name="collection">Collection that the limit is associated with.</param> /// <returns>Amount of disk space that the collection is limited to.</returns> static public long GetLimit(Collection collection) { PolicyManager pm = new PolicyManager(); Policy policy = pm.GetPolicy(DiskSpaceQuotaPolicyID, collection); return((policy != null) ? ( long )GetRule(policy).Operand : -1); }
/// <summary> /// Gets the file type filter patterns associated with the current user on the current machine. /// </summary> /// <returns>Array of file type filter patterns for this policy if successful. If there are no /// filter patterns then null is returned.</returns> static public FileTypeEntry[] GetPatterns() { PolicyManager pm = new PolicyManager(); Policy policy = pm.GetPolicy(FileTypeFilterPolicyID); return((policy != null) ? GetPatterns(policy) : null); }
/// <summary> /// Gets the status of Disable sharing associated with the specified domain. /// </summary> /// <param name="domainID">Domain that the interval is associated with.</param> /// <returns>the status of Disable Sharing as an int</returns> static public int GetStatus(string domainID) { PolicyManager pm = new PolicyManager(); Policy policy = pm.GetPolicy(DisableSharingPolicyID, domainID); return((policy != null) ? ( int )policy.GetValue(DisableSharingStatusTag) : 0); }
public MailServiceController(IConfiguration config, PolicyManager policyManager, IndustryManager industryManager) { Config = config; _policyManager = policyManager; AppSettings = config.GetSection("AppSettings") .Get <AppSettingsModel>(); graphSettingsModel = config.GetSection("GraphApi") .Get <GraphSettingsModel>(); this.industryManager = industryManager; SigningCredentials = new Lazy <X509SigningCredentials>(() => { var certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser); certStore.Open(OpenFlags.ReadOnly); var certCollection = certStore.Certificates.Find( X509FindType.FindByThumbprint, AppSettings.SigningCertThumbprint, false); // Get the first cert with the thumb-print if (certCollection.Count > 0) { return(new X509SigningCredentials(certCollection[0])); } throw new Exception("Certificate not found"); }); }
private void ConfigureCustomerAuthentication( IConfiguration configuration, IServiceCollection services, AuthenticationBuilder authenticationBuilder, PolicyManager manager) { var authenticationOptions = AuthenticationCustomerOptions.Construct(configuration); var policyList = manager.CustomerPolicySetupList; authenticationBuilder.AddOpenIdConnect(Constants.AuthenticationSchemes.CustomerAuth, options => { options.Authority = authenticationOptions.Authority; options.CallbackPath = new PathString("/b2c-signin-callback"); options.ClientId = authenticationOptions.ClientId; options.ClientSecret = authenticationOptions.ClientSecret; options.CorrelationCookie.Expiration = TimeSpan.FromHours(3); options.ConfigurationManager = new PolicyConfigurationManager( authenticationOptions.Authority, policyList); options.Events = CreateB2COpenIdConnectEvents(manager); options.Scope.Remove("profile"); options.SignedOutCallbackPath = new PathString("/b2c-signout-callback"); options.TokenValidationParameters = new TokenValidationParameters { NameClaimType = Constants.ClaimTypes.Name }; }); }
public static string GetAppLockerPolicy(PolicyType policyType, string ldapPath = "", bool xmlOutput = false) { AppLockerPolicy appLockerPolicy; if (policyType == PolicyType.Local) { appLockerPolicy = PolicyManager.GetLocalPolicy(); } else if (policyType == PolicyType.Domain) { appLockerPolicy = PolicyManager.GetDomainPolicy(ldapPath); } else { if (policyType != PolicyType.Effective) { throw new InvalidOperationException(); } appLockerPolicy = PolicyManager.GetEffectivePolicy(); } if (xmlOutput) { return(appLockerPolicy.ToXml()); } return(JsonConvert.SerializeObject(appLockerPolicy, Formatting.Indented)); }
public override PolicyStatement Resolve(Evidence evidence) { if (evidence == null) { throw new ArgumentNullException("evidence"); } object obj = null; if (PolicyManager.CheckMembershipCondition(base.MembershipCondition, evidence, out obj)) { PolicyStatement policyStatement = base.PolicyStatement; IDelayEvaluatedEvidence delayEvaluatedEvidence = obj as IDelayEvaluatedEvidence; bool flag = delayEvaluatedEvidence != null && !delayEvaluatedEvidence.IsVerified; if (flag) { policyStatement.AddDependentEvidence(delayEvaluatedEvidence); } bool flag2 = false; IEnumerator enumerator = base.Children.GetEnumerator(); while (enumerator.MoveNext() && !flag2) { PolicyStatement policyStatement2 = PolicyManager.ResolveCodeGroup(enumerator.Current as CodeGroup, evidence); if (policyStatement2 != null) { policyStatement.InplaceUnion(policyStatement2); if ((policyStatement2.Attributes & PolicyStatementAttribute.Exclusive) == PolicyStatementAttribute.Exclusive) { flag2 = true; } } } return(policyStatement); } return(null); }
private void ConfigureBusinessCustomerAuthentication( IConfiguration configuration, AuthenticationBuilder authenticationBuilder, PolicyManager manager) { var authenticationOptions = AuthenticationCustomerOptions.Construct(Configuration); var policyList = manager.BusinessCustomerPolicySetupList; // BusinessCustomerPolicySetupList authenticationBuilder.AddOpenIdConnect(Constants.AuthenticationSchemes.BusinessCustomerAuth, options => { options.Authority = authenticationOptions.Authority; options.CallbackPath = new PathString("/b2b-signin-callback"); options.ClientId = authenticationOptions.ClientId; options.CorrelationCookie.Expiration = TimeSpan.FromHours(3); options.ConfigurationManager = new PolicyConfigurationManager( authenticationOptions.Authority, policyList); options.Events = CreateB2BOpenIdConnectEvents(); options.SignedOutCallbackPath = new PathString("/b2b-signout-callback"); options.TokenValidationParameters = new TokenValidationParameters { NameClaimType = Constants.ClaimTypes.Name }; }); }
private void EndEvent() { PolicyManager.ApplyPolicy(); State = GameState.End; levelManager = GameObject.FindObjectOfType <LevelManager>() as LevelManager; levelManager.LoadLevel("02b Game Report"); }
/// <summary> /// Handles the SaveChanges event of the EditSaveControl control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> void EditSaveControl_SaveChanges(object sender, SaveControl.SaveEventArgs e) { // Validate form if (!this.Page.IsValid) { e.RunScript = false; return; } PolicyDto policy = (PolicyDto)Session[_PolicyDtoEditSessionKey]; if (PolicyId > 0 && policy == null) { policy = PolicyManager.GetPolicyDto(PolicyId); } else if (PolicyId == 0) { policy = new PolicyDto(); } IDictionary context = new ListDictionary(); context.Add(_PolicyDtoString, policy); ViewControl.SaveChanges(context); if (policy.HasChanges()) { PolicyManager.SavePolicy(policy); } // we don't need to store Dto in session any more Session.Remove(_PolicyDtoEditSessionKey); }
/// <summary> /// Initializes a new instance of an object. /// </summary> /// <param name="member">Member that this file size filter is associated with.</param> private FileSizeFilter(Member member) { PolicyManager pm = new PolicyManager(); this.memberPolicy = pm.GetAggregatePolicy(FileSizeFilterPolicyID, member); this.limit = GetUserAggregateLimit(memberPolicy); }
/// <summary> /// Gets the file size limit associated with the current user on the current machine. /// </summary> /// <returns>Size of files that all users in the domain are limited to.</returns> static public long GetLimit() { PolicyManager pm = new PolicyManager(); Policy policy = pm.GetPolicy(FileSizeFilterPolicyID); return((policy != null) ? ( long )GetRule(policy).Operand : 0); }
/// <summary> /// Deletes a file size filter policy for the specified member. /// </summary> /// <param name="member">Member that the filter will be associated with.</param> static public void Delete(Member member) { // Need a policy manager. PolicyManager pm = new PolicyManager(); // Delete the policy. pm.DeletePolicy(FileSizeFilterPolicyID, member); }