/// <summary> /// Given an poBox object , it will return the rule for a PolicyID /// only one rule is returned /// </summary> public void GetRuleForPolicyID(POBox.POBox poBox, string PolicyID, ref Member member) { string RuleList = "RuleList"; Simias.Policy.Rule rule = null; ICSList list = poBox.Search(PropertyTags.PolicyID, PolicyID, SearchOp.Equal); foreach (ShallowNode sn in list) { Simias.Policy.Policy tempPolicy = new Simias.Policy.Policy(poBox, sn); if (tempPolicy.IsSystemPolicy) { MultiValuedList mvl = tempPolicy.Properties.GetProperties(RuleList); if (mvl.Count > 0) { foreach (Property p in mvl) { if (p != null) { rule = new Simias.Policy.Rule(p.Value); Property prop = new Property(PolicyID, rule.ToString()); prop.ServerOnlyProperty = true; member.Properties.ModifyProperty(prop); break; } } } } } return; }
/// <summary> /// Extracts all the member policies from POBox and stores them as part of member object on master . No aggregation is done. /// </summary> public void ExtractMemberPolicies(string domainID, Member member, ShallowNode sn, bool OnMaster) { Store store = Store.GetStore(); Domain domain = store.GetDomain(domainID); string RuleList = "RuleList"; Simias.Policy.Rule rule = null; int Value = -1; bool committed = false; Property FileTypeProperty; Property EncProperty; Property SyncIntervalProperty; ICSList list; POBox.POBox poBox = POBox.POBox.FindPOBox(store, domainID, member.UserID); if (poBox == null) { return; } // First extract rule based policies // Extracting FileType policy list = poBox.Search(PropertyTags.PolicyID, Simias.Policy.FileTypeFilter.FileTypeFilterPolicyID, SearchOp.Equal); Simias.Policy.Policy tempPolicy = null; foreach (ShallowNode snl in list) { tempPolicy = new Simias.Policy.Policy(poBox, snl); if (tempPolicy.IsSystemPolicy) { MultiValuedList mvl = tempPolicy.Properties.GetProperties(RuleList); if (mvl.Count > 0) { log.Debug("mvl count for filetype filter is" + mvl.Count); foreach (Property p in mvl) { if (p != null) { rule = new Simias.Policy.Rule(p.Value); FileTypeProperty = new Property(Simias.Policy.FileTypeFilter.FileTypeFilterPolicyID, rule.ToString()); FileTypeProperty.ServerOnlyProperty = true; member.Properties.AddNodeProperty(FileTypeProperty); } } } } } GetRuleForPolicyID(poBox, Simias.Policy.DiskSpaceQuota.DiskSpaceQuotaPolicyID, ref member); GetRuleForPolicyID(poBox, Simias.Policy.FileSizeFilter.FileSizeFilterPolicyID, ref member); Value = GetValueForPolicyID(poBox, Simias.Policy.SecurityState.EncryptionStatePolicyID, Simias.Policy.SecurityState.StatusTag); if (Value != -1) { EncProperty = new Property(Simias.Policy.SecurityState.EncryptionStatePolicyID, Value); EncProperty.ServerOnlyProperty = true; member.Properties.ModifyProperty(EncProperty); } Value = GetValueForPolicyID(poBox, Simias.Policy.SyncInterval.SyncIntervalPolicyID, Simias.Policy.SyncInterval.IntervalTag); if (Value != -1) { SyncIntervalProperty = new Property(Simias.Policy.SyncInterval.SyncIntervalPolicyID, Value); SyncIntervalProperty.ServerOnlyProperty = true; member.Properties.ModifyProperty(SyncIntervalProperty); } if (OnMaster) { // User is provisioned on master so no need to call web-service domain.Commit(member); poBox.Commit(poBox.Delete()); log.Debug("Committed member's property(policy) on master successfully so deleting his POBox.. " + member.FN); } else { committed = CommitOnMaster(domainID, member, sn); if (committed == true) { log.Debug("Committed member's property(policy) on master successfully so deleting his POBox.. " + member.FN); poBox.Commit(poBox.Delete()); } else { log.Debug("Could not commit member's property(policy) on master so not deleting his POBox.. Next time it can be tried"); } } }