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
- Privilege.cs
- CounterSampleCalculator.cs
- WindowsSlider.cs
- MobileControlsSection.cs
- AsynchronousChannel.cs
- SocketCache.cs
- Condition.cs
- WebPartsPersonalizationAuthorization.cs
- TreeNodeEventArgs.cs
- TypeDescriptionProvider.cs
- SecurityKeyUsage.cs
- LinkLabel.cs
- PersonalizationStateInfo.cs
- NamespaceInfo.cs
- ControlPropertyNameConverter.cs
- SqlExpressionNullability.cs
- XamlInt32CollectionSerializer.cs
- Misc.cs
- RNGCryptoServiceProvider.cs
- StrongTypingException.cs
- CodeDomLocalizationProvider.cs
- ChameleonKey.cs
- ApplicationDirectoryMembershipCondition.cs
- TemplateManager.cs
- ToolBarButton.cs
- ListView.cs
- RtType.cs
- StreamInfo.cs
- ApplicationManager.cs
- RightsManagementPermission.cs
- MethodCallTranslator.cs
- ContentPosition.cs
- Int16.cs
- NoClickablePointException.cs
- WebExceptionStatus.cs
- ScriptRegistrationManager.cs
- ContextCorrelationInitializer.cs
- ImpersonateTokenRef.cs
- TaskExtensions.cs
- NativeMethods.cs
- CollectionConverter.cs
- ConversionContext.cs
- TogglePattern.cs
- webbrowsersite.cs
- AnnotationHelper.cs
- compensatingcollection.cs
- EllipseGeometry.cs
- HtmlTableCellCollection.cs
- TypeDescriptionProvider.cs
- DataChangedEventManager.cs
- EventLogPermissionEntry.cs
- LinqDataSourceDeleteEventArgs.cs
- DoWorkEventArgs.cs
- WebBaseEventKeyComparer.cs
- BindingListCollectionView.cs
- FormViewInsertEventArgs.cs
- ResourceReferenceExpression.cs
- CodeTypeMember.cs
- ResetableIterator.cs
- ResourceWriter.cs
- SynthesizerStateChangedEventArgs.cs
- XamlWrapperReaders.cs
- QilTargetType.cs
- XmlDomTextWriter.cs
- Timer.cs
- Queue.cs
- HighlightVisual.cs
- BaseDataList.cs
- SmtpCommands.cs
- LambdaCompiler.ControlFlow.cs
- DataGridViewCellStyleChangedEventArgs.cs
- DateTimeUtil.cs
- StringUtil.cs
- ThreadAttributes.cs
- CodeTypeDelegate.cs
- EdmItemError.cs
- CommandID.cs
- DiscoveryClientRequestChannel.cs
- CodeIdentifier.cs
- WebPartDescriptionCollection.cs
- CorePropertiesFilter.cs
- DataListItem.cs
- CustomAttribute.cs
- MatrixTransform.cs
- DataGridViewCheckBoxCell.cs
- PassportPrincipal.cs
- sitestring.cs
- RectConverter.cs
- SessionStateSection.cs
- DbConnectionPool.cs
- HostProtectionException.cs
- ColumnMapCopier.cs
- DateTimeConverter2.cs
- ClientTarget.cs
- CategoryValueConverter.cs
- TemplateBindingExtension.cs
- SmiXetterAccessMap.cs
- Int32KeyFrameCollection.cs
- ItemAutomationPeer.cs
- FixedFindEngine.cs