Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / RoleGroup.cs / 1305376 / RoleGroup.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System.ComponentModel; using System.Security.Principal; using System.Web.Security; ////// Associates a collection of roles with a template. /// 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
- SqlProfileProvider.cs
- Roles.cs
- InputDevice.cs
- MarkedHighlightComponent.cs
- LineServicesCallbacks.cs
- SQLByteStorage.cs
- ByteStorage.cs
- CodeStatement.cs
- SkewTransform.cs
- GreenMethods.cs
- GridProviderWrapper.cs
- RawUIStateInputReport.cs
- SafeHandles.cs
- SiteMapNode.cs
- ResourceDictionaryCollection.cs
- PersianCalendar.cs
- EventMappingSettingsCollection.cs
- OperationResponse.cs
- ByteStorage.cs
- SafeNativeMethodsCLR.cs
- DataGridBoolColumn.cs
- ReadOnlyHierarchicalDataSource.cs
- Models.cs
- SupportsPreviewControlAttribute.cs
- EditorZoneBase.cs
- Dispatcher.cs
- Brush.cs
- RijndaelManagedTransform.cs
- MetafileHeader.cs
- ResourcesGenerator.cs
- HideDisabledControlAdapter.cs
- Pen.cs
- NullableConverter.cs
- SslStream.cs
- AutoGeneratedField.cs
- ClientSettings.cs
- base64Transforms.cs
- ConfigsHelper.cs
- IndexerNameAttribute.cs
- dataobject.cs
- SkewTransform.cs
- BitmapInitialize.cs
- TreeNodeStyle.cs
- XamlHostingConfiguration.cs
- MeasurementDCInfo.cs
- StringWriter.cs
- XmlSiteMapProvider.cs
- PersonalizationProvider.cs
- Matrix.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- DataGridViewButtonCell.cs
- GridProviderWrapper.cs
- DelegatedStream.cs
- XmlText.cs
- ClientApiGenerator.cs
- CommandField.cs
- UniqueIdentifierService.cs
- RC2.cs
- initElementDictionary.cs
- ScriptIgnoreAttribute.cs
- ListCommandEventArgs.cs
- XmlCharacterData.cs
- GraphicsPathIterator.cs
- BitmapScalingModeValidation.cs
- TreeNodeEventArgs.cs
- ThreadExceptionEvent.cs
- UrlPath.cs
- OdbcException.cs
- _BasicClient.cs
- DataGridTextColumn.cs
- securitymgrsite.cs
- InvalidPropValue.cs
- Component.cs
- ResizeBehavior.cs
- State.cs
- ResXBuildProvider.cs
- TreeView.cs
- Win32.cs
- InvalidPrinterException.cs
- ResourceFallbackManager.cs
- LZCodec.cs
- ChannelEndpointElementCollection.cs
- SelectedDatesCollection.cs
- CodeCommentStatementCollection.cs
- PolicyStatement.cs
- AttributeEmitter.cs
- ProcessModelInfo.cs
- BindingGraph.cs
- Transform3D.cs
- DbConvert.cs
- Track.cs
- ClientBuildManager.cs
- SizeConverter.cs
- SR.cs
- ConditionalWeakTable.cs
- HttpException.cs
- ObjectListComponentEditor.cs
- WebPartTransformerAttribute.cs
- TrailingSpaceComparer.cs
- EventWaitHandleSecurity.cs