internal static bool CheckProviderCapabilities(
     ProviderCapabilities capability,
     ProviderInfo provider)
 {
     using (CmdletProviderManagementIntrinsics.tracer.TraceMethod(provider.Name, new object[0]))
         return((provider.Capabilities & capability) != ProviderCapabilities.None);
 }
        /// <summary>
        /// Determines if the specified provider has the specified capability.
        /// </summary>
        /// <param name="capability">
        /// The capability to check the provider for.
        /// </param>
        /// <param name="provider">
        /// The provider information to use for the check.
        /// </param>
        /// <returns>
        /// True, if the provider has the capability, false otherwise.
        /// </returns>
        internal static bool CheckProviderCapabilities(
            ProviderCapabilities capability,
            ProviderInfo provider)
        {
            // Check the capability

            return((provider.Capabilities & capability) != 0);
        }
 public CmdletProviderAttribute(string providerName, ProviderCapabilities providerCapabilities)
 {
     using (CmdletProviderAttribute.tracer.TraceConstructor((object)this))
     {
         if (string.IsNullOrEmpty(providerName))
         {
             throw CmdletProviderAttribute.tracer.NewArgumentNullException(nameof(providerName));
         }
         this.provider             = providerName.IndexOfAny(this.illegalCharacters) == -1 ? providerName : throw CmdletProviderAttribute.tracer.NewArgumentException(nameof(providerName), "SessionStateStrings", "ProviderNameNotValid", (object)providerName);
         this.providerCapabilities = providerCapabilities;
     }
 }
示例#4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            //Checks if provider supports creating users.
            if (!ProviderCapabilities.IsSupported(ProviderFacade.GetDefaultMembershipProviderName(), ProviderCapabilities.Action.Create))
            {
                RegistrationWizard.Visible             = false;
                ProviderDoNotSupportCreateUser.Visible = true;
                ProviderDoNotSupportCreateUser.Text    = string.Format("<br />" + Translate("/admin/secedit/providerdonotsupportcreateuser"), ProviderFacade.GetDefaultMembershipProviderName());
            }
        }
示例#5
0
 protected ProviderInfo(ProviderInfo providerInfo)
 {
     this.helpFile = "";
     if (providerInfo == null)
     {
         throw PSTraceSource.NewArgumentNullException("providerInfo");
     }
     this.name = providerInfo.Name;
     this.implementingType = providerInfo.ImplementingType;
     this.capabilities = providerInfo.capabilities;
     this.description = providerInfo.description;
     this.hiddenDrive = providerInfo.hiddenDrive;
     this.home = providerInfo.home;
     this.helpFile = providerInfo.helpFile;
     this.pssnapin = providerInfo.pssnapin;
     this.sessionState = providerInfo.sessionState;
 }
示例#6
0
 protected ProviderInfo(ProviderInfo providerInfo)
 {
     this.helpFile = "";
     if (providerInfo == null)
     {
         throw PSTraceSource.NewArgumentNullException("providerInfo");
     }
     this.name             = providerInfo.Name;
     this.implementingType = providerInfo.ImplementingType;
     this.capabilities     = providerInfo.capabilities;
     this.description      = providerInfo.description;
     this.hiddenDrive      = providerInfo.hiddenDrive;
     this.home             = providerInfo.home;
     this.helpFile         = providerInfo.helpFile;
     this.pssnapin         = providerInfo.pssnapin;
     this.sessionState     = providerInfo.sessionState;
 }
示例#7
0
        /// <summary>
        /// Constructs an instance of the class using an existing reference
        /// as a template.
        /// </summary>
        /// <param name="providerInfo">
        /// The provider information to copy to this instance.
        /// </param>
        /// <remarks>
        /// This constructor should be used by derived types to easily copying
        /// the base class members from an existing ProviderInfo.
        /// This is designed for use by a <see cref="System.Management.Automation.Provider.CmdletProvider"/>
        /// during calls to their <see cref="System.Management.Automation.Provider.CmdletProvider.Start(ProviderInfo)"/> method.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="providerInfo"/> is null.
        /// </exception>
        protected ProviderInfo(ProviderInfo providerInfo)
        {
            if (providerInfo == null)
            {
                throw PSTraceSource.NewArgumentNullException("providerInfo");
            }

            Name = providerInfo.Name;
            ImplementingType = providerInfo.ImplementingType;
            _capabilities = providerInfo._capabilities;
            Description = providerInfo.Description;
            _hiddenDrive = providerInfo._hiddenDrive;
            Home = providerInfo.Home;
            HelpFile = providerInfo.HelpFile;
            PSSnapIn = providerInfo.PSSnapIn;
            _sessionState = providerInfo._sessionState;
            VolumeSeparatedByColon = providerInfo.VolumeSeparatedByColon;
        }
示例#8
0
        /// <summary>
        /// Constructor for the attribute.
        /// </summary>
        /// <param name="providerName">
        /// The provider name.
        /// </param>
        /// <param name="providerCapabilities">
        /// An enumeration of the capabilities that the provider implements beyond the
        /// default capabilities that are required.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="providerName"/> is null or empty.
        /// </exception>
        /// <exception cref="PSArgumentException">
        /// If <paramref name="providerName"/> contains any of the following characters: \ [ ] ? * :
        /// </exception>
        public CmdletProviderAttribute(
            string providerName,
            ProviderCapabilities providerCapabilities)
        {
            // verify parameters

            if (string.IsNullOrEmpty(providerName))
            {
                throw PSTraceSource.NewArgumentNullException("providerName");
            }

            if (providerName.IndexOfAny(_illegalCharacters) != -1)
            {
                throw PSTraceSource.NewArgumentException(
                          "providerName",
                          SessionStateStrings.ProviderNameNotValid,
                          providerName);
            }

            ProviderName         = providerName;
            ProviderCapabilities = providerCapabilities;
        }
        /// <summary>
        /// Constructor for the attribute.
        /// </summary>
        ///
        /// <param name="providerName">
        /// The provider name.
        /// </param>
        ///
        /// <param name="providerCapabilities">
        /// An enumeration of the capabilities that the provider implements beyond the
        /// default capabilities that are required.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="providerName"/> is null or empty.
        /// </exception>
        /// 
        /// <exception cref="PSArgumentException">
        /// If <paramref name="providerName"/> contains any of the following characters: \ [ ] ? * :
        /// </exception>
        public CmdletProviderAttribute(
            string providerName,
            ProviderCapabilities providerCapabilities)
        {
            // verify parameters

            if (String.IsNullOrEmpty(providerName))
            {
                throw PSTraceSource.NewArgumentNullException("providerName");
            }

            if (providerName.IndexOfAny(_illegalCharacters) != -1)
            {
                throw PSTraceSource.NewArgumentException(
                    "providerName",
                    SessionStateStrings.ProviderNameNotValid,
                    providerName);
            }

            ProviderName = providerName;
            ProviderCapabilities = providerCapabilities;
        } // constructor
示例#10
0
 public CmdletProviderAttribute(string providerName, ProviderCapabilities providerCapabilities)
 {
     ProviderName         = providerName;
     ProviderCapabilities = providerCapabilities;
 }
示例#11
0
        /// <summary>
        /// Constructs an instance of the class using an existing reference
        /// as a template.
        /// </summary>
        /// 
        /// <param name="providerInfo">
        /// The provider information to copy to this instance.
        /// </param>
        /// 
        /// <remarks>
        /// This constructor should be used by derived types to easily copying
        /// the base class members from an existing ProviderInfo.
        /// This is designed for use by a <see cref="System.Management.Automation.Provider.CmdletProvider"/>
        /// during calls to their <see cref="System.Management.Automation.Provider.CmdletProvider.Start(ProviderInfo)"/> method.
        /// </remarks>
        /// 
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="providerInfo"/> is null.
        /// </exception>
        protected ProviderInfo(ProviderInfo providerInfo)
        {
            if (providerInfo == null)
            {
                throw PSTraceSource.NewArgumentNullException("providerInfo");
            }

            Name = providerInfo.Name;
            ImplementingType = providerInfo.ImplementingType;
            _capabilities = providerInfo._capabilities;
            Description = providerInfo.Description;
            _hiddenDrive = providerInfo._hiddenDrive;
            Home = providerInfo.Home;
            HelpFile = providerInfo.HelpFile;
            PSSnapIn = providerInfo.PSSnapIn;
            _sessionState = providerInfo._sessionState;
            VolumeSeparatedByColon = providerInfo.VolumeSeparatedByColon;
        }
示例#12
0
        } // GetAll

        #endregion Public methods

        #region Internal methods

        /// <summary>
        /// Determines if the specified provider has the specified capability
        /// </summary>
        ///
        /// <param name="capability">
        /// The capability to check the provider for.
        /// </param>
        ///
        /// <param name="provider">
        /// The provider information to use for the check.
        /// </param>
        ///
        /// <returns>
        /// True, if the provider has the capability, false otherwise.
        /// </returns>
        /// 
        internal static bool CheckProviderCapabilities(
            ProviderCapabilities capability,
            ProviderInfo provider)
        {
            // Check the capability

            return (provider.Capabilities & capability) != 0;
        } // CheckProviderCapabilities
示例#13
0
 public CmdletProviderAttribute(string providerName, ProviderCapabilities providerCapabilities)
 {
     ProviderName = providerName;
     ProviderCapabilities = providerCapabilities;
 }
示例#14
0
 internal static bool CheckProviderCapabilities(ProviderCapabilities capability, ProviderInfo provider)
 {
     return((provider.Capabilities & capability) != ProviderCapabilities.None);
 }
 internal static bool CheckProviderCapabilities(ProviderCapabilities capability, ProviderInfo provider)
 {
     return ((provider.Capabilities & capability) != ProviderCapabilities.None);
 }
示例#16
0
 private static void RegisterCustomProviders()
 {
     ProviderCapabilities.AddProvider(typeof(FarmdayRoleProvider), new ProviderCapabilitySettings(0));
     ProviderCapabilities.AddProvider(typeof(FarmdayMembershipProvider), new ProviderCapabilitySettings(0));
 }