Esempio n. 1
0
 public void RemoveStorePermission()
 {
     try
     {
         var toRemove = Tuple.Create(1, "itamar", "AddSales");
         SPDB.Remove(toRemove);
         li = SPDB.Get();
         Assert.AreEqual(li.Count, 0);
     }
     catch (Exception e)
     { Assert.AreEqual(true, false, "there was a connection error to the testing db"); }
 }
        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);
        }
Esempio n. 3
0
 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);
 }