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
- PartitionerStatic.cs
- HttpDebugHandler.cs
- PageThemeParser.cs
- Enlistment.cs
- BevelBitmapEffect.cs
- QueryAccessibilityHelpEvent.cs
- EventLogPermissionEntry.cs
- WeakRefEnumerator.cs
- Thread.cs
- SizeFConverter.cs
- CorrelationActionMessageFilter.cs
- BevelBitmapEffect.cs
- LoadMessageLogger.cs
- LineBreak.cs
- MessageLoggingElement.cs
- ToolboxItemLoader.cs
- SynchronizedDispatch.cs
- OdbcCommandBuilder.cs
- DisposableCollectionWrapper.cs
- AutomationElement.cs
- XhtmlBasicCommandAdapter.cs
- Tag.cs
- PageContentAsyncResult.cs
- CodeGroup.cs
- UnionCqlBlock.cs
- ObjectAnimationBase.cs
- RegexParser.cs
- OutOfMemoryException.cs
- ConfigurationSectionCollection.cs
- SQlBooleanStorage.cs
- RootBrowserWindowProxy.cs
- GeometryConverter.cs
- CodeDomConfigurationHandler.cs
- ClaimTypes.cs
- GridViewColumnHeaderAutomationPeer.cs
- TransformGroup.cs
- WinInetCache.cs
- SqlFormatter.cs
- DynamicILGenerator.cs
- ZipIOFileItemStream.cs
- XamlDesignerSerializationManager.cs
- Dump.cs
- TextEditorTables.cs
- EDesignUtil.cs
- DBSchemaRow.cs
- HideDisabledControlAdapter.cs
- IMembershipProvider.cs
- StronglyTypedResourceBuilder.cs
- ACE.cs
- Line.cs
- XmlMembersMapping.cs
- StylusEditingBehavior.cs
- DiscreteKeyFrames.cs
- DataGridViewCellPaintingEventArgs.cs
- ServiceOperationParameter.cs
- LocalFileSettingsProvider.cs
- MaskedTextBox.cs
- MenuEventArgs.cs
- CompilerGeneratedAttribute.cs
- CommittableTransaction.cs
- DataGridParentRows.cs
- SpecialNameAttribute.cs
- Grant.cs
- CursorConverter.cs
- Events.cs
- ActiveXHost.cs
- ExtensionFile.cs
- ProjectedSlot.cs
- ObjectTypeMapping.cs
- HttpListenerRequest.cs
- TypedElement.cs
- GradientBrush.cs
- SendSecurityHeaderElementContainer.cs
- LoadItemsEventArgs.cs
- unitconverter.cs
- SqlCommand.cs
- AppDomainManager.cs
- Viewport3DVisual.cs
- AvTraceDetails.cs
- ProjectionQueryOptionExpression.cs
- BitmapEffectDrawingContent.cs
- Rule.cs
- RepeaterCommandEventArgs.cs
- ScriptManager.cs
- StateItem.cs
- RowToFieldTransformer.cs
- ExtensionQuery.cs
- ArithmeticLiteral.cs
- ProcessModuleCollection.cs
- Image.cs
- SelectedGridItemChangedEvent.cs
- DiscoveryVersion.cs
- DBNull.cs
- NopReturnReader.cs
- EntityConnectionStringBuilder.cs
- SourceLineInfo.cs
- DataConnectionHelper.cs
- MessageContractMemberAttribute.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- DbProviderFactories.cs