Exemple #1
0
 private bool HasAccessForWxeFunctionCommand()
 {
     if (_wxeSecurityAdapter == null)
     {
         return(true);
     }
     return(_wxeSecurityAdapter.HasStatelessAccess(WxeFunctionCommand.ResolveFunctionType()));
 }
Exemple #2
0
        /// <summary>
        ///   Gets the permanent URL for the <see cref="WxeFunction"/> defined by the
        ///   <see cref="Command.WxeFunctionCommandInfo"/>.
        /// </summary>
        /// <param name="additionalUrlParameters">
        ///   The <see cref="NameValueCollection"/> containing additional url parameters.
        ///   Must not be <see langword="null"/>.
        /// </param>
        /// <exception cref="InvalidOperationException">
        ///   <para>
        ///     Thrown if called while the <see cref="Type"/> is not set to <see cref="CommandType.WxeFunction"/>.
        ///   </para><para>
        ///     Thrown if neither the <see cref="Command.WxeFunctionCommandInfo.MappingID"/> nor the
        ///     <see cref="Command.WxeFunctionCommandInfo.TypeName"/> are set.
        ///   </para><para>
        ///     Thrown if the <see cref="Command.WxeFunctionCommandInfo.MappingID"/> and
        ///     <see cref="Command.WxeFunctionCommandInfo.TypeName"/> specify different functions.
        ///   </para>
        /// </exception>
        public virtual string GetWxeFunctionPermanentUrl(NameValueCollection additionalUrlParameters)
        {
            ArgumentUtility.CheckNotNull("additionalUrlParameters", additionalUrlParameters);

            if (Type != CommandType.WxeFunction)
            {
                throw new InvalidOperationException("Call to ExecuteWxeFunction not allowed unless Type is set to CommandType.WxeFunction.");
            }

            Type functionType = WxeFunctionCommand.ResolveFunctionType();

            WxeParameterDeclaration[] parameterDeclarations = WxeVariablesContainer.GetParameterDeclarations(functionType);
            object[] parameterValues = WxeVariablesContainer.ParseActualParameters(
                parameterDeclarations, WxeFunctionCommand.Parameters, CultureInfo.InvariantCulture);

            NameValueCollection queryString = WxeVariablesContainer.SerializeParametersForQueryString(parameterDeclarations, parameterValues);

            queryString.Set(WxeHandler.Parameters.WxeReturnToSelf, true.ToString());
            NameValueCollectionUtility.Append(queryString, additionalUrlParameters);

            return(WxeContext.GetPermanentUrl(new HttpContextWrapper(HttpContext.Current), functionType, queryString));
        }