示例#1
0
        public ActionResult UpdateUsers(int id)
        {
            //Method Level Variable Declarations
            List <Exception>         excepts = new List <Exception>();
            GuacamoleDatabaseDeleter deleter = new GuacamoleDatabaseDeleter();

            return(Ok(deleter.DeleteConnectionGroup(id.ToString(), ref excepts)));
        }
示例#2
0
        /// <summary>
        /// Deletes the specified connection group and user group.
        /// </summary>
        /// <param name="userId">User identifier.</param>
        /// <param name="groupName">Group name.</param>
        public void DeleteGroup(string userId, string groupName)
        {
            List <Exception>         excepts = new List <Exception>();
            GuacamoleDatabaseDeleter deleter = new GuacamoleDatabaseDeleter();

            deleter.DeleteUserGroup(groupName, ref excepts);
            deleter.DeleteConnectionGroup(groupName, ref excepts);

            if (excepts.Count == 0)
            {
                return;
            }
            else
            {
                Console.Write("Error");
                return;
            }
        }
示例#3
0
        public async Task <IActionResult> DeleteGroup(GroupNameDto groupNameDto)
        {
            List <Exception>         excepts = new List <Exception>();
            GuacamoleDatabaseDeleter deleter = new GuacamoleDatabaseDeleter();

            deleter.DeleteUserGroup(groupNameDto.Name, ref excepts);
            deleter.DeleteConnectionGroup(groupNameDto.Name, ref excepts);

            if (excepts.Count == 0)
            {
                return(Ok());
            }
            else
            {
                var message = HandleErrors(excepts);
                return(BadRequest(message));
            }
        }
示例#4
0
        public ActionResult UpdateUsers(GroupsToAddDto groupsToAddDto)
        {
            //Method Level Variable Declarations
            List <Exception>          excepts  = new List <Exception>();
            GuacamoleDatabaseInserter inserter = new GuacamoleDatabaseInserter();
            GuacamoleDatabaseDeleter  deleter  = new GuacamoleDatabaseDeleter();
            GuacamoleDatabaseSearcher searcher = new GuacamoleDatabaseSearcher();

            if (!searcher.SearchConnectedUserGroup(groupsToAddDto.Id.ToString(), ref excepts))
            {
                inserter.InsertUserGroup(groupsToAddDto.Id, ref excepts);
                inserter.InsertConnectionGroupIntoUserGroup(groupsToAddDto.Id, false, ref excepts);
            }

            if (excepts.Count != 0)
            {
                return(Ok(false));
            }

            foreach (string id in groupsToAddDto.AddIds)
            {
                //Insert users that are not in the system
                if (!InitializeUser(id, ref excepts))
                {
                    var message = HandleErrors(excepts);
                    return(Ok(false));
                }
                inserter.InsertUserIntoUserGroup(groupsToAddDto.Id, id, ref excepts);
            }

            foreach (string id in groupsToAddDto.RemoveIds)
            {
                deleter.DeleteUserFromUserGroup(groupsToAddDto.Id, id, ref excepts);
            }
            return(Ok(true));
        }
        /// <summary>
        /// Deletes the user from the given user group.
        /// </summary>
        /// <returns><c>true</c>, if user was deleted from the user group, <c>false</c> otherwise.</returns>
        /// <param name="dawgtag">Dawgtag.</param>
        /// <param name="excepts">Excepts.</param>
        private bool RemoveUserFromGroup(string groupName, string dawgtag, ref List <Exception> excepts)
        {
            GuacamoleDatabaseDeleter deleter = new GuacamoleDatabaseDeleter();

            return(deleter.DeleteUserFromUserGroup(groupName, dawgtag, ref excepts));
        }