public string Remove(string text, IAclRule rule) { var list = Read(text).ToList(); list.Remove(rule); return Write(list); }
public string Add(string text,IAclRule rule){ var list = Read(text).ToList(); if(!list.Contains(rule)){ list.Add(rule); } return Write(list); }
public IAclRepository Add(IAclRule rule, AclRuleStorageLevel level){ if(AclRuleStorageLevel.Memory==level){ Container.get<IAclInMemoryRuleProvider>().Add(rule); } else if(AclRuleStorageLevel.Application==level){ Container.get<IAclApplicationRuleProvider>().Add(rule); } else{ throw new NotSupportedException("Пока только в память умею писать"); } invokeOnChange(); return this; }
public void Remove(IAclRule rule){ var ruleToRemove = rules.FirstOrDefault(r => r.Equals(rule)); if(null!=ruleToRemove){ rules.Remove(ruleToRemove); } }
public void Add(IAclRule rule){ rule.Evidence = "memory"; if(null==rules.FirstOrDefault(r=>r.Equals(rule))){ rules.Add(rule); } }
public virtual bool Equals(IAclRule other){ if (ReferenceEquals(null, other)){ return false; } if (ReferenceEquals(this, other)){ return true; } return Equals(other.TokenMask, TokenMask) && Equals(other.PrincipalMask, PrincipalMask) && Equals(other.RuleType, RuleType) && Equals(other.Permissions, Permissions) && Equals(other.System, System); }
public void Remove(IAclRule rule){ var olddata = FileSystem.Read(usrFileName); var serializer = new AclRuleXmlSerializer(); FileSystem.Write(usrFileName, serializer.Remove(olddata, rule)); }
public IAclRepository Remove(IAclRule rule){ return Remove(rule, AclRuleStorageLevel.Memory); }
public IAclRepository Add(IAclRule rule){ return Add(rule, AclRuleStorageLevel.Memory); }