Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SemanticAnalyzer.cs
- ExtensionDataObject.cs
- SerializationInfo.cs
- ValidatedControlConverter.cs
- ObjectDataSource.cs
- FlowLayout.cs
- IndexerNameAttribute.cs
- PropertyEmitter.cs
- CompressionTransform.cs
- SerializationSectionGroup.cs
- ReceiveParametersContent.cs
- ReadOnlyHierarchicalDataSource.cs
- BaseValidator.cs
- VsPropertyGrid.cs
- IdnMapping.cs
- OwnerDrawPropertyBag.cs
- PageOutputQuality.cs
- XpsPackagingException.cs
- VisualTransition.cs
- ErrorsHelper.cs
- SpeechSeg.cs
- TypeConverterHelper.cs
- TextRangeEditTables.cs
- TextTreeRootNode.cs
- WebPartDescription.cs
- TemplateApplicationHelper.cs
- GatewayIPAddressInformationCollection.cs
- File.cs
- EndpointDispatcherTable.cs
- CngAlgorithm.cs
- sitestring.cs
- _SecureChannel.cs
- ProfileBuildProvider.cs
- TableHeaderCell.cs
- RemoteHelper.cs
- SectionUpdates.cs
- OleServicesContext.cs
- baseshape.cs
- Int64AnimationBase.cs
- ParallelTimeline.cs
- RichTextBox.cs
- Int32RectValueSerializer.cs
- HttpChannelHelpers.cs
- EventMappingSettings.cs
- ClientSettings.cs
- MetadataArtifactLoaderCompositeResource.cs
- DoubleAnimationUsingPath.cs
- ObjRef.cs
- LogLogRecordHeader.cs
- XmlParserContext.cs
- CodeCompileUnit.cs
- ASCIIEncoding.cs
- ProxyWebPart.cs
- SQLDateTime.cs
- RangeValueProviderWrapper.cs
- CursorConverter.cs
- ErrorHandler.cs
- SequenceRangeCollection.cs
- PrivilegedConfigurationManager.cs
- PriorityRange.cs
- DataBindingList.cs
- EventToken.cs
- SwitchCase.cs
- PhysicalFontFamily.cs
- QuadTree.cs
- DesignerWebPartChrome.cs
- WinEventHandler.cs
- MetadataItemEmitter.cs
- MissingMemberException.cs
- TimeEnumHelper.cs
- MarginsConverter.cs
- NotFiniteNumberException.cs
- QueryCreatedEventArgs.cs
- GlyphCache.cs
- ComAdminWrapper.cs
- ValidationEventArgs.cs
- TabItemAutomationPeer.cs
- Mutex.cs
- InteropBitmapSource.cs
- ProcessModuleCollection.cs
- UnsafeNativeMethods.cs
- EntityDescriptor.cs
- LoginView.cs
- ServicePoint.cs
- HttpRuntime.cs
- MILUtilities.cs
- XamlParser.cs
- PtsHelper.cs
- FontSource.cs
- Expressions.cs
- SynchronousSendBindingElement.cs
- Codec.cs
- Tokenizer.cs
- ComplexType.cs
- OleDbConnectionFactory.cs
- MetadataPropertyCollection.cs
- WebOperationContext.cs
- ActiveXMessageFormatter.cs
- NameValueCollection.cs
- TypeGenericEnumerableViewSchema.cs