Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- _NTAuthentication.cs
- WebPartTransformer.cs
- SoapObjectWriter.cs
- MultiByteCodec.cs
- CodeTypeMemberCollection.cs
- TextParentUndoUnit.cs
- SerializationSectionGroup.cs
- Nullable.cs
- XmlnsCompatibleWithAttribute.cs
- ToolboxComponentsCreatingEventArgs.cs
- JournalNavigationScope.cs
- CodeEventReferenceExpression.cs
- BaseCodePageEncoding.cs
- RootProfilePropertySettingsCollection.cs
- ListViewSortEventArgs.cs
- ServiceMetadataExtension.cs
- ArgIterator.cs
- ParameterToken.cs
- ClientRolePrincipal.cs
- autovalidator.cs
- MetadataCache.cs
- EdmFunctions.cs
- FactoryId.cs
- RelatedImageListAttribute.cs
- MenuCommands.cs
- ZeroOpNode.cs
- CompilerGlobalScopeAttribute.cs
- ServicesUtilities.cs
- RequestQueue.cs
- InputLangChangeRequestEvent.cs
- CleanUpVirtualizedItemEventArgs.cs
- TimeoutException.cs
- OdbcParameter.cs
- TCPListener.cs
- DatasetMethodGenerator.cs
- XmlNodeList.cs
- dataSvcMapFileLoader.cs
- DataGridViewColumnTypePicker.cs
- NativeMethods.cs
- SimpleTextLine.cs
- VerticalAlignConverter.cs
- SqlRowUpdatedEvent.cs
- StringValueSerializer.cs
- DataFormats.cs
- CustomErrorsSectionWrapper.cs
- DateTimeFormatInfo.cs
- RijndaelCryptoServiceProvider.cs
- Privilege.cs
- LineVisual.cs
- CommentEmitter.cs
- DbProviderFactories.cs
- PersonalizablePropertyEntry.cs
- DefaultObjectMappingItemCollection.cs
- AggregateNode.cs
- NotifyParentPropertyAttribute.cs
- HttpClientCredentialType.cs
- Pipe.cs
- ArrangedElementCollection.cs
- ToolStripSeparator.cs
- RemotingServices.cs
- EntityDescriptor.cs
- PropertyInformationCollection.cs
- QueryConverter.cs
- ExtensionSimplifierMarkupObject.cs
- ExecutionContext.cs
- FileNameEditor.cs
- ValidationErrorCollection.cs
- BevelBitmapEffect.cs
- WebHostScriptMappingsInstallComponent.cs
- OracleTimeSpan.cs
- SchemaInfo.cs
- SimpleType.cs
- MatrixCamera.cs
- MouseActionValueSerializer.cs
- DataControlLinkButton.cs
- FlowNode.cs
- PersonalizationProvider.cs
- WebPartMinimizeVerb.cs
- EventListenerClientSide.cs
- NativeMethods.cs
- ResizeGrip.cs
- recordstatefactory.cs
- WebBrowserNavigatedEventHandler.cs
- TextEvent.cs
- WrappedOptions.cs
- Lease.cs
- ItemCheckedEvent.cs
- XslTransform.cs
- ContentPresenter.cs
- CmsInterop.cs
- GridViewCellAutomationPeer.cs
- DocumentViewerBaseAutomationPeer.cs
- MasterPage.cs
- IpcChannel.cs
- TcpStreams.cs
- CompositeControl.cs
- XmlLoader.cs
- CommonDialog.cs
- GridToolTip.cs
- DataGridTextBox.cs