Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. // //----------------------------------------------------------------------------- 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ModifierKeysValueSerializer.cs
- ScriptDescriptor.cs
- OperationPerformanceCounters.cs
- Number.cs
- ContentType.cs
- ImageMap.cs
- DispatcherHookEventArgs.cs
- ListControlConvertEventArgs.cs
- RoleManagerModule.cs
- HttpCookieCollection.cs
- CodeDomConfigurationHandler.cs
- MarkupExtensionSerializer.cs
- TextTreeFixupNode.cs
- ColorTransform.cs
- FactoryGenerator.cs
- cryptoapiTransform.cs
- sqlnorm.cs
- DebugView.cs
- ProcessModule.cs
- ViewGenerator.cs
- LinearKeyFrames.cs
- ListViewGroup.cs
- CompilerResults.cs
- LinkLabelLinkClickedEvent.cs
- ToolStripDesignerAvailabilityAttribute.cs
- JapaneseCalendar.cs
- WebHeaderCollection.cs
- DbMetaDataCollectionNames.cs
- ExpressionVisitorHelpers.cs
- Metafile.cs
- TypeSource.cs
- FieldInfo.cs
- TimeoutException.cs
- ComplexType.cs
- TypeElementCollection.cs
- Model3DGroup.cs
- StyleXamlParser.cs
- SqlDependencyUtils.cs
- TdsValueSetter.cs
- WebBrowserBase.cs
- UInt16.cs
- Action.cs
- DataControlButton.cs
- Fx.cs
- KnownAssemblyEntry.cs
- PersonalizationProviderCollection.cs
- PipelineComponent.cs
- ScaleTransform3D.cs
- WsatExtendedInformation.cs
- _HeaderInfoTable.cs
- WindowsNonControl.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- PropertyKey.cs
- EntityTypeEmitter.cs
- NullEntityWrapper.cs
- SpellerStatusTable.cs
- CodeCatchClauseCollection.cs
- RsaSecurityTokenAuthenticator.cs
- RegexGroup.cs
- FamilyMap.cs
- HtmlDocument.cs
- DispatchWrapper.cs
- WinEventHandler.cs
- ImportCatalogPart.cs
- PreviewKeyDownEventArgs.cs
- BindingMAnagerBase.cs
- Knowncolors.cs
- Clipboard.cs
- Size.cs
- ColumnReorderedEventArgs.cs
- PeerNeighborManager.cs
- GradientStop.cs
- SystemFonts.cs
- GridViewPageEventArgs.cs
- PropertiesTab.cs
- SkinBuilder.cs
- HttpHostedTransportConfiguration.cs
- Completion.cs
- DelegatingConfigHost.cs
- PartialTrustVisibleAssembly.cs
- ADConnectionHelper.cs
- Transactions.cs
- path.cs
- SqlReferenceCollection.cs
- StreamReader.cs
- MimeMultiPart.cs
- KeyEventArgs.cs
- WindowsRichEditRange.cs
- WebBrowserHelper.cs
- Automation.cs
- ReadWriteSpinLock.cs
- ConfigurationLocation.cs
- HttpConfigurationSystem.cs
- CopyNodeSetAction.cs
- DbDataReader.cs
- HttpHeaderCollection.cs
- SQLGuid.cs
- RepeaterItem.cs
- TypeUnloadedException.cs
- TextElementEditingBehaviorAttribute.cs