Пример #1
0
        public static void addStoreOwner(string[] fullcommand)
        {
            if (fullcommand.Length == 4)
            {
                string username   = fullcommand[1];
                string storeName  = fullcommand[2];
                string newManager = fullcommand[3];

                try
                {
                    User  user    = getUser(username, users[username]);
                    Store store   = getStore(storeName);
                    int   storeId = store.id;

                    Roles  roles     = new Roles(true, true, true, false, false, false, false, false, true);
                    string sushiRole = JsonHandler.SerializeObject(roles);

                    UserService.AddStoreManager(user, storeId, newManager, sushiRole);
                    Logger.Log("event", logLevel.INFO, $"Init system: user {user} is now store owner of {storeName}");
                }
                catch (Exception e) {
                    Logger.Log("error", logLevel.ERROR, $"Init system: add store owner {e.Data}");
                }
            }
            else
            {
                Logger.Log("error", logLevel.ERROR, "Init system: add store owner bad input");
            }
        }
Пример #2
0
 public bool AddStoreManager(int storeId, string userToAdd, string roles)
 {
     if (!loggedIn)
     {
         notLoggedInException();
     }
     return(UserService.AddStoreManager(user, storeId, userToAdd, roles));
 }
Пример #3
0
        public string AddStoreManager(int storeId, string userToAdd, string roles)
        {
            if (!loggedIn)
            {
                return(notLoggedInError());
            }
            bool ret;

            try
            {
                ret = UserService.AddStoreManager(user, storeId, userToAdd, roles);
                return(resultJson(ret));
            }
            catch (Exception e)
            {
                return(generateMessageFormatJason(e.Message));
            }
        }