public void AddStorePermission() { try { var toAdd = Tuple.Create(1, "aviad", "DeleteSales"); SPDB.Add(toAdd); li = SPDB.Get(); Assert.AreEqual(li.Count, 2); } catch (Exception e) { Assert.AreEqual(true, false, "there was a connection error to the testing db"); } }
public void init() { WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB(); cDB.emptyDB(); configuration.DB_MODE = testing; SPDB = new StorePremissionsDB(testing); li = new LinkedList <Tuple <int, String, String> >(); // storeId, username, permission SPDB.Add(Tuple.Create(1, "itamar", "AddSales")); }
public void editProductInStore(string username, Boolean allow) { if (!privileges.ContainsKey(username)) { privileges.Add(username, new Premissions()); } StorePremissionsDB SPDB = new StorePremissionsDB(configuration.DB_MODE); if (allow) { if (!checkPrivilege(username, "editProductInStore")) { SPDB.Add(new Tuple <int, String, String>(storeId, username, "editProductInStore")); } } else { SPDB.Remove(new Tuple <int, String, String>(storeId, username, "editProductInStore")); } privileges[username].editProductInStore(allow); }
public void addProductInStore(int storeId, string username, Boolean allow) { if (!privilegesOfaStore.ContainsKey(storeId)) { privilegesOfaStore.Add(storeId, new StorePremissions(storeId)); } if (allow) { if (!checkPrivilege(storeId, username, "addProductInStore")) { SPDB.Add(new Tuple <int, String, String>(storeId, username, "addProductInStore")); } } else { SPDB.Remove(new Tuple <int, String, String>(storeId, username, "addProductInStore")); } privilegesOfaStore[storeId].getPrivileges(username).addProductInStore(allow); }