Esempio n. 1
0
        /// <summary>
        /// Validates the existing name of a group.
        /// </summary>
        /// <returns><c>true</c>, if new group name was validated, <c>false</c> otherwise.</returns>
        /// <param name="groupName">Group name.</param>
        /// <param name="exceptions">Exceptions.</param>
        public bool ValidateExistingGroupName(string groupName, ref List <Exception> exceptions)
        {
            string execptMessage = $"The given group name {groupName} does not exist.";

            GuacamoleDatabaseSearcher searcher = new GuacamoleDatabaseSearcher();

            if (!searcher.SearchConnectionGroupName(groupName, ref exceptions))
            {
                exceptions.Add(new ValidationException(execptMessage));
                return(false);
            }
            if (!searcher.SearchUserGroupName(groupName, ref exceptions))
            {
                exceptions.Add(new ValidationException(execptMessage));
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        /*******************************************************************************
         *------------------------Primary Validator Methods----------------------------*
         ******************************************************************************/
        /// <summary>
        /// Validates the name of the group by checking if the given name exists within
        /// the guacamole database.
        /// </summary>
        /// <param name="groupName">Group name.</param>
        public bool ValidateNewGroupName(string groupName, ref List <Exception> exceptions)
        {
            string execptMessage = $"The given group name {groupName} already " +
                                   "exists. Please choose another name or edit the existing group.";

            GuacamoleDatabaseSearcher searcher = new GuacamoleDatabaseSearcher();

            if (searcher.SearchConnectionGroupName(groupName, ref exceptions))
            {
                exceptions.Add(new ValidationException(execptMessage));
                return(false);
            }
            if (searcher.SearchUserGroupName(groupName, ref exceptions))
            {
                exceptions.Add(new ValidationException(execptMessage));
                return(false);
            }
            return(true);
        }