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
- XmlReflectionImporter.cs
- NullableBoolConverter.cs
- InputLanguageManager.cs
- IntPtr.cs
- Rect.cs
- SuppressMessageAttribute.cs
- BamlRecordReader.cs
- XsdBuildProvider.cs
- NetworkAddressChange.cs
- SchemaHelper.cs
- ObjectSecurity.cs
- DataServiceContext.cs
- ModelPropertyCollectionImpl.cs
- SizeF.cs
- pingexception.cs
- EditorPartChrome.cs
- RIPEMD160Managed.cs
- ResourcePart.cs
- HttpCacheVary.cs
- HttpSocketManager.cs
- ButtonFieldBase.cs
- TemplateBindingExtensionConverter.cs
- TypeRefElement.cs
- ZipIOLocalFileHeader.cs
- UpdateException.cs
- IntSecurity.cs
- QueryExpression.cs
- MediaPlayer.cs
- x509utils.cs
- IPCCacheManager.cs
- PauseStoryboard.cs
- wgx_sdk_version.cs
- Size.cs
- BooleanAnimationBase.cs
- LassoHelper.cs
- Configuration.cs
- MessageSecurityVersion.cs
- WebPartMovingEventArgs.cs
- CalendarDay.cs
- StreamGeometry.cs
- FrameworkContentElement.cs
- RegexGroupCollection.cs
- FixedPage.cs
- StatusCommandUI.cs
- SchemaRegistration.cs
- DockAndAnchorLayout.cs
- DelegateSerializationHolder.cs
- XmlNamedNodeMap.cs
- DataGridViewComboBoxColumn.cs
- SizeFConverter.cs
- ActivationArguments.cs
- CorrelationActionMessageFilter.cs
- SmiXetterAccessMap.cs
- MarkupWriter.cs
- HyperLinkField.cs
- DescriptionAttribute.cs
- RightNameExpirationInfoPair.cs
- ObjectContext.cs
- DownloadProgressEventArgs.cs
- Pens.cs
- Vector3D.cs
- TaiwanLunisolarCalendar.cs
- MouseButton.cs
- RootBuilder.cs
- AdornerDecorator.cs
- CollectionContainer.cs
- PropertyToken.cs
- NamedPipeAppDomainProtocolHandler.cs
- QuaternionAnimation.cs
- ColumnResult.cs
- MaskInputRejectedEventArgs.cs
- Comparer.cs
- PointLightBase.cs
- OpacityConverter.cs
- TrackPointCollection.cs
- ComplexType.cs
- EndSelectCardRequest.cs
- CheckBoxBaseAdapter.cs
- PermissionAttributes.cs
- TextAnchor.cs
- XDRSchema.cs
- FixedSOMLineCollection.cs
- HMACMD5.cs
- ServiceDescription.cs
- AnnotationElement.cs
- WorkerRequest.cs
- NativeRecognizer.cs
- ComplexLine.cs
- SmtpReplyReader.cs
- BitmapPalettes.cs
- HtmlToClrEventProxy.cs
- UnmanagedMemoryStream.cs
- XmlCollation.cs
- InvalidCommandTreeException.cs
- CapiHashAlgorithm.cs
- DocumentXmlWriter.cs
- GcSettings.cs
- XmlSchemaObjectTable.cs
- AnyReturnReader.cs
- If.cs