Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / 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. //------------------------------------------------------------------------------ //// 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
- XsdValidatingReader.cs
- ArrayList.cs
- LayoutUtils.cs
- CngKeyCreationParameters.cs
- WebBrowserProgressChangedEventHandler.cs
- AdapterDictionary.cs
- invalidudtexception.cs
- XsltArgumentList.cs
- XmlRawWriterWrapper.cs
- PropertyFilterAttribute.cs
- Array.cs
- Page.cs
- XXXInfos.cs
- AccessDataSourceView.cs
- ChannelPool.cs
- AspNetSynchronizationContext.cs
- WaveHeader.cs
- VisualProxy.cs
- OdbcUtils.cs
- HuffCodec.cs
- DataGridColumn.cs
- MILUtilities.cs
- WindowsStreamSecurityBindingElement.cs
- OletxTransactionManager.cs
- HttpCacheVaryByContentEncodings.cs
- ActivityDesignerAccessibleObject.cs
- UnauthorizedWebPart.cs
- DataGridBoolColumn.cs
- CompoundFileStreamReference.cs
- PartialCachingAttribute.cs
- DetailsViewDeleteEventArgs.cs
- EdgeProfileValidation.cs
- HtmlProps.cs
- PocoPropertyAccessorStrategy.cs
- UpdateEventArgs.cs
- AsyncResult.cs
- ObjectMaterializedEventArgs.cs
- ProfileSettings.cs
- ComponentCommands.cs
- XPathNodeIterator.cs
- Fonts.cs
- QuadraticBezierSegment.cs
- TemplateControlCodeDomTreeGenerator.cs
- DefaultMemberAttribute.cs
- Rotation3DAnimationUsingKeyFrames.cs
- ConfigXmlText.cs
- listitem.cs
- GraphicsState.cs
- DESCryptoServiceProvider.cs
- JobDuplex.cs
- XmlWriterSettings.cs
- UnmanagedMemoryStreamWrapper.cs
- HtmlValidationSummaryAdapter.cs
- SchemaContext.cs
- ContextToken.cs
- CodeExpressionCollection.cs
- CodeDomExtensionMethods.cs
- DeclarativeCatalogPart.cs
- typedescriptorpermissionattribute.cs
- ReachBasicContext.cs
- entitydatasourceentitysetnameconverter.cs
- BufferedWebEventProvider.cs
- UnhandledExceptionEventArgs.cs
- CodeTypeParameter.cs
- StagingAreaInputItem.cs
- dsa.cs
- ParallelTimeline.cs
- RenderOptions.cs
- UInt64.cs
- TableLayoutCellPaintEventArgs.cs
- XmlDeclaration.cs
- peernodestatemanager.cs
- DataGridBeginningEditEventArgs.cs
- PolicyLevel.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- FilteredDataSetHelper.cs
- HtmlInputPassword.cs
- MemoryMappedView.cs
- AmbientValueAttribute.cs
- ComponentEvent.cs
- RowsCopiedEventArgs.cs
- DependencyObjectPropertyDescriptor.cs
- SqlTypesSchemaImporter.cs
- _FtpDataStream.cs
- Light.cs
- DynamicMethod.cs
- FactorySettingsElement.cs
- OutputCacheSettingsSection.cs
- CompoundFileStorageReference.cs
- DigitalSignature.cs
- JsonReaderDelegator.cs
- TextElement.cs
- WebPartConnectVerb.cs
- ListViewAutomationPeer.cs
- CodeAttributeArgumentCollection.cs
- TraceLog.cs
- NativeMethods.cs
- NotCondition.cs
- ServiceManager.cs
- HttpListenerException.cs