Esempio n. 1
0
        /// <summary>
        /// Validates the user's keywords for admin flags and sends a standardized message
        /// to the user.
        /// </summary>
        public static bool AdminFlagCheckAndNotify(this ICommandManager commandManager, IEntity user, IFlagContext FlagContext)
        {
            var returnVal = true;

            try
            {
                Validation.IsNotNull(commandManager, "commandManager");
                Validation.IsNotNull(user, "user");
                Validation.IsNotNull(FlagContext, "FlagContext");
                Validation.Validate(FlagContext.IsAdmin());
            }
            catch
            {
                returnVal = false;
                commandManager.ReportToCharacter(Resources.MSG_NOT_AUTHORIZED, user);
            }

            return(returnVal);
        }
        /// <summary>
        /// User has the proper flags to be a builder
        /// </summary>
        public static bool IsBuilder(this IFlagContext flags)
        {
            Validation.IsNotNull(flags, "flags");

            return(flags.IsAdmin() || flags.HasFlag("Builder"));
        }