public void addPermission(aPermission permission) { if (permmisions == null) { permmisions = new basePermmision("", null); } permmisions.addPermission(permission); }
public override ICollection <PersmissionsTypes> GetPermissions(string storeName) { if (permmisions == null || permmisions.next == null) { return(null); } ICollection <PersmissionsTypes> ans = new List <PersmissionsTypes>(); aPermission corrent = permmisions; while (corrent.next != null) { corrent = corrent.next; if (corrent.store.Equals(storeName)) { ans.Add(corrent.who()); } } return(ans); }
public bool removePermission(string storeName, string userSponser) { if (permmisions == null) { return(false); } aPermission start = null; aPermission prev = null; aPermission corrent = permmisions.next; while (corrent != null) { if (corrent.store.Equals(storeName) && corrent.sponser != null && corrent.sponser.Equals(userSponser)) { if (start == null) { start = permmisions; if (prev == null) { prev = permmisions; } } } else { if (start != null) { prev.next = corrent; return(true); } } corrent = corrent.next; } if (start != null) { prev.next = null; return(true); } return(false); }
public override Dictionary <string, ICollection <string> > GetAllPermissions() { aPermission corrent = permmisions; string storeName = ""; bool first = true; bool firstfirst = true; Dictionary <string, ICollection <string> > ans = new Dictionary <string, ICollection <string> >(); ICollection <string> list = new List <string>(); if (corrent == null) { return(null); } while (corrent.next != null) { //if (corrent.store.Equals("")) //storeName = corrent.store; corrent = corrent.next; if (firstfirst) { storeName = corrent.store; firstfirst = false; } if (!(storeName.Equals(corrent.store))) { if (first) { ans[storeName] = list; first = false; storeName = corrent.store; } list = new List <string>(); } list.Add(aPermission.who(corrent.who())); } ans[storeName] = list; return(ans); }
public bool editPermission(string storeName, string userSponser, aPermission permission) { addPermission(permission); return(true); }