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
- DbDataReader.cs
- RegexRunnerFactory.cs
- FormViewPagerRow.cs
- InputMethodStateTypeInfo.cs
- Form.cs
- ParallelTimeline.cs
- GridView.cs
- HijriCalendar.cs
- ReflectionUtil.cs
- DecimalAnimation.cs
- DataListItem.cs
- SymbolEqualComparer.cs
- DesignerPerfEventProvider.cs
- FormViewModeEventArgs.cs
- PrintDialogException.cs
- UnhandledExceptionEventArgs.cs
- Misc.cs
- WebPartDisplayModeEventArgs.cs
- SemaphoreSlim.cs
- ListDictionary.cs
- SafePEFileHandle.cs
- WorkflowIdleBehavior.cs
- NetworkStream.cs
- MenuItemCollection.cs
- AutomationPatternInfo.cs
- SecurityTokenException.cs
- SqlRetyper.cs
- BuildDependencySet.cs
- XmlSchemaGroup.cs
- ISFClipboardData.cs
- DataServiceKeyAttribute.cs
- EventLogEntry.cs
- ToolStripLabel.cs
- NamespaceCollection.cs
- CodeTypeReferenceCollection.cs
- UrlRoutingModule.cs
- DoubleAnimationClockResource.cs
- DBSchemaTable.cs
- DataGridTable.cs
- WebDescriptionAttribute.cs
- ExceptionUtil.cs
- FrameworkElement.cs
- CompleteWizardStep.cs
- ZipIOCentralDirectoryBlock.cs
- StackSpiller.cs
- SoapSchemaMember.cs
- GridViewDeleteEventArgs.cs
- DrawingState.cs
- PersistChildrenAttribute.cs
- RequestNavigateEventArgs.cs
- UIPermission.cs
- SqlUDTStorage.cs
- TlsnegoTokenAuthenticator.cs
- Rethrow.cs
- SharedConnectionWorkflowTransactionService.cs
- NotSupportedException.cs
- XmlSyndicationContent.cs
- SchemaComplexType.cs
- BinaryVersion.cs
- TemplateField.cs
- ParserHooks.cs
- ResumeStoryboard.cs
- ButtonPopupAdapter.cs
- FileDialogCustomPlaces.cs
- RepeatButton.cs
- DesignerAttribute.cs
- DataBindingHandlerAttribute.cs
- XdrBuilder.cs
- SiteIdentityPermission.cs
- UnauthorizedAccessException.cs
- StorageInfo.cs
- DependencyProperty.cs
- ShowExpandedMultiValueConverter.cs
- SQLDateTimeStorage.cs
- UIElementParaClient.cs
- LocalizationComments.cs
- _TLSstream.cs
- Scheduling.cs
- BatchParser.cs
- Point3DValueSerializer.cs
- CodeSnippetStatement.cs
- XmlWriterTraceListener.cs
- PartialCachingAttribute.cs
- MemberAccessException.cs
- StatusBarPanelClickEvent.cs
- RegistrationServices.cs
- CategoryNameCollection.cs
- ErrorWrapper.cs
- DateTime.cs
- UnmanagedMarshal.cs
- IPipelineRuntime.cs
- ResourceContainer.cs
- ByteConverter.cs
- wgx_sdk_version.cs
- HtmlControlAdapter.cs
- HandlerBase.cs
- TypeInitializationException.cs
- BitSet.cs
- ConnectionManagementElement.cs
- GetIsBrowserClientRequest.cs