Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / xsp / System / Web / UI / WebControls / RoleGroup.cs / 1 / RoleGroup.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System.ComponentModel; using System.Security.Permissions; using System.Security.Principal; using System.Web.Security; ////// Associates a collection of roles with a template. /// [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class RoleGroup { private ITemplate _contentTemplate; private string[] _roles; ////// The template associated with the roles. /// [ Browsable(false), DefaultValue(null), PersistenceMode(PersistenceMode.InnerProperty), TemplateContainer(typeof(LoginView)), ] public ITemplate ContentTemplate { get { return _contentTemplate; } set { _contentTemplate = value; } } ////// The roles associated with the template. /// [ TypeConverterAttribute(typeof(StringArrayConverter)), ] public string[] Roles { get { if (_roles == null) { return new string[0]; } else { // Must clone to preserve encapsulation return (string[]) _roles.Clone(); } } set { if (value == null) { _roles = value; } else { // Must clone to preserve encapsulation _roles = (string[]) value.Clone(); } } } ////// Whether the user is in any of the roles. /// public bool ContainsUser(IPrincipal user) { if (user == null) { throw new ArgumentNullException("user"); } if (_roles == null) { return false; } foreach (string role in _roles) { if (user.IsInRole(role)) { return true; } } return false; } ////// For appearance in designer collection editor. /// public override string ToString() { StringArrayConverter converter = new StringArrayConverter(); return converter.ConvertToString(Roles); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System.ComponentModel; using System.Security.Permissions; using System.Security.Principal; using System.Web.Security; ////// Associates a collection of roles with a template. /// [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class RoleGroup { private ITemplate _contentTemplate; private string[] _roles; ////// The template associated with the roles. /// [ Browsable(false), DefaultValue(null), PersistenceMode(PersistenceMode.InnerProperty), TemplateContainer(typeof(LoginView)), ] public ITemplate ContentTemplate { get { return _contentTemplate; } set { _contentTemplate = value; } } ////// The roles associated with the template. /// [ TypeConverterAttribute(typeof(StringArrayConverter)), ] public string[] Roles { get { if (_roles == null) { return new string[0]; } else { // Must clone to preserve encapsulation return (string[]) _roles.Clone(); } } set { if (value == null) { _roles = value; } else { // Must clone to preserve encapsulation _roles = (string[]) value.Clone(); } } } ////// Whether the user is in any of the roles. /// public bool ContainsUser(IPrincipal user) { if (user == null) { throw new ArgumentNullException("user"); } if (_roles == null) { return false; } foreach (string role in _roles) { if (user.IsInRole(role)) { return true; } } return false; } ////// For appearance in designer collection editor. /// public override string ToString() { StringArrayConverter converter = new StringArrayConverter(); return converter.ConvertToString(Roles); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Expr.cs
- Msmq3PoisonHandler.cs
- XmlSchemaAnnotated.cs
- ObjectHandle.cs
- Constraint.cs
- XmlSchemaComplexType.cs
- DataServiceExpressionVisitor.cs
- FormViewDeletedEventArgs.cs
- NeutralResourcesLanguageAttribute.cs
- TextControlDesigner.cs
- ButtonStandardAdapter.cs
- ClientSettingsProvider.cs
- BuildProviderUtils.cs
- BindingExpression.cs
- DashStyles.cs
- Error.cs
- AuthorizationRule.cs
- DataControlFieldTypeEditor.cs
- ComboBox.cs
- HebrewCalendar.cs
- XpsS0ValidatingLoader.cs
- BitmapEffectGroup.cs
- EntityDataSourceSelectingEventArgs.cs
- BitmapCodecInfo.cs
- BaseDataList.cs
- XamlPathDataSerializer.cs
- RegexParser.cs
- PipelineComponent.cs
- EntityContainerAssociationSet.cs
- Int64Converter.cs
- DesignOnlyAttribute.cs
- CodeStatementCollection.cs
- ListControlDesigner.cs
- SystemTcpConnection.cs
- BaseProcessProtocolHandler.cs
- PreviewKeyDownEventArgs.cs
- WindowsIdentity.cs
- ETagAttribute.cs
- WSDualHttpBindingElement.cs
- ExpressionPrefixAttribute.cs
- XmlDataLoader.cs
- tooltip.cs
- ControlType.cs
- EtwTrace.cs
- ProgressiveCrcCalculatingStream.cs
- SortedDictionary.cs
- DSACryptoServiceProvider.cs
- ResourceReferenceKeyNotFoundException.cs
- ComponentEditorForm.cs
- PeerIPHelper.cs
- DocumentSchemaValidator.cs
- VirtualPathUtility.cs
- XmlFormatReaderGenerator.cs
- DynamicUpdateCommand.cs
- SettingsProviderCollection.cs
- EtwTrace.cs
- TextSpan.cs
- NullableLongAverageAggregationOperator.cs
- GeneralTransformCollection.cs
- ObjectReaderCompiler.cs
- SByte.cs
- ELinqQueryState.cs
- SafeProcessHandle.cs
- EmptyStringExpandableObjectConverter.cs
- JavaScriptString.cs
- BevelBitmapEffect.cs
- BooleanFunctions.cs
- CollectionView.cs
- Wizard.cs
- ToolbarAUtomationPeer.cs
- TableItemPattern.cs
- ScrollItemPatternIdentifiers.cs
- ApplicationDirectory.cs
- StateManagedCollection.cs
- MatrixTransform3D.cs
- CustomLineCap.cs
- ComboBox.cs
- CornerRadius.cs
- GenerateTemporaryTargetAssembly.cs
- CommandBindingCollection.cs
- XsltException.cs
- HyperLinkDataBindingHandler.cs
- ComponentEditorForm.cs
- WebPartsPersonalization.cs
- CounterSample.cs
- ElementFactory.cs
- SafePointer.cs
- BitVec.cs
- RequiredFieldValidator.cs
- SingleResultAttribute.cs
- PageEventArgs.cs
- GridPattern.cs
- Compiler.cs
- AstTree.cs
- DbConnectionOptions.cs
- EdmPropertyAttribute.cs
- SQLInt64.cs
- GCHandleCookieTable.cs
- ComponentEditorPage.cs
- HtmlSelectionListAdapter.cs