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
- StateWorkerRequest.cs
- DataGridCellItemAutomationPeer.cs
- RenderTargetBitmap.cs
- PipelineComponent.cs
- UnsafeNativeMethods.cs
- Comparer.cs
- CommandTreeTypeHelper.cs
- DataGridViewRowCancelEventArgs.cs
- TextSegment.cs
- ImmutableObjectAttribute.cs
- ProcessModule.cs
- FlowLayout.cs
- BevelBitmapEffect.cs
- TreeChangeInfo.cs
- IPAddressCollection.cs
- XsdDateTime.cs
- ToolStripSeparatorRenderEventArgs.cs
- EncryptedType.cs
- Accessible.cs
- SystemDiagnosticsSection.cs
- documentsequencetextpointer.cs
- NonSerializedAttribute.cs
- InternalCache.cs
- MissingFieldException.cs
- ManageRequest.cs
- SessionPageStateSection.cs
- DropAnimation.xaml.cs
- LoggedException.cs
- HandlerMappingMemo.cs
- ConfigurationValue.cs
- ColorContext.cs
- SettingsSavedEventArgs.cs
- SafeLocalMemHandle.cs
- WebFormDesignerActionService.cs
- LogWriteRestartAreaAsyncResult.cs
- ScaleTransform3D.cs
- SHA384.cs
- WebPartEditVerb.cs
- RequiredAttributeAttribute.cs
- ThousandthOfEmRealPoints.cs
- ColumnHeaderCollectionEditor.cs
- TypeDescriptionProvider.cs
- XpsS0ValidatingLoader.cs
- PageThemeCodeDomTreeGenerator.cs
- HttpTransportManager.cs
- MenuBase.cs
- FontStretches.cs
- TableLayoutColumnStyleCollection.cs
- ObjectSet.cs
- Pts.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- TaskResultSetter.cs
- ThrowHelper.cs
- AppearanceEditorPart.cs
- CqlQuery.cs
- Attribute.cs
- BamlRecordReader.cs
- ProcessThread.cs
- PrivilegeNotHeldException.cs
- SqlDataReaderSmi.cs
- CursorInteropHelper.cs
- HwndStylusInputProvider.cs
- TemplateManager.cs
- MdiWindowListItemConverter.cs
- CancellationHandlerDesigner.cs
- Dynamic.cs
- RectangleGeometry.cs
- BinaryReader.cs
- GridView.cs
- UInt64.cs
- IndexerNameAttribute.cs
- XamlSerializationHelper.cs
- CharConverter.cs
- Vector3DAnimationUsingKeyFrames.cs
- WmlSelectionListAdapter.cs
- ToolStripDropDown.cs
- TabItemAutomationPeer.cs
- LockCookie.cs
- XmlDictionary.cs
- SafeHandles.cs
- PropertyCollection.cs
- BuilderPropertyEntry.cs
- TypeDependencyAttribute.cs
- SplitterCancelEvent.cs
- EncodingNLS.cs
- StylesEditorDialog.cs
- BindableAttribute.cs
- OleDbWrapper.cs
- EntityDataSourceViewSchema.cs
- Int32Storage.cs
- PowerStatus.cs
- XmlBoundElement.cs
- ZoneIdentityPermission.cs
- WindowsFont.cs
- QueryOutputWriter.cs
- XmlAttribute.cs
- EntityClientCacheKey.cs
- AlgoModule.cs
- RNGCryptoServiceProvider.cs
- AssemblyName.cs