Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / RoleGroup.cs / 1305376 / RoleGroup.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System.ComponentModel; using System.Security.Principal; using System.Web.Security; ////// Associates a collection of roles with a template. /// 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.Principal; using System.Web.Security; ////// Associates a collection of roles with a template. /// 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
- MetadataUtilsSmi.cs
- XDRSchema.cs
- ItemTypeToolStripMenuItem.cs
- BufferedGraphics.cs
- ResourceProviderFactory.cs
- BevelBitmapEffect.cs
- Logging.cs
- SendParametersContent.cs
- VarInfo.cs
- AttachedPropertyMethodSelector.cs
- TrackingServices.cs
- ProcessModelSection.cs
- RemoteWebConfigurationHostStream.cs
- PolyLineSegment.cs
- Collection.cs
- ColorConvertedBitmap.cs
- AsmxEndpointPickerExtension.cs
- DataGridSortCommandEventArgs.cs
- coordinator.cs
- WindowsUpDown.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- HtmlEncodedRawTextWriter.cs
- ToolBar.cs
- TextProperties.cs
- Delegate.cs
- LogicalChannelCollection.cs
- DocumentOrderQuery.cs
- MimeAnyImporter.cs
- Vector3DConverter.cs
- TextTrailingWordEllipsis.cs
- MetafileHeader.cs
- TTSEngineTypes.cs
- ScrollPattern.cs
- DocumentOrderComparer.cs
- InternalConfigSettingsFactory.cs
- DataGridCellsPanel.cs
- ClientType.cs
- TypeReference.cs
- VirtualizingPanel.cs
- TextTreeDeleteContentUndoUnit.cs
- Symbol.cs
- NamespaceCollection.cs
- BooleanFunctions.cs
- DataShape.cs
- XsltConvert.cs
- CursorConverter.cs
- DeadCharTextComposition.cs
- TypeKeyValue.cs
- RadioButtonAutomationPeer.cs
- RequestResizeEvent.cs
- CodeRemoveEventStatement.cs
- DataBoundControlAdapter.cs
- ScriptMethodAttribute.cs
- StorageMappingItemLoader.cs
- DescendantBaseQuery.cs
- _LocalDataStore.cs
- RoutedEventHandlerInfo.cs
- CompatibleIComparer.cs
- PageRanges.cs
- NotImplementedException.cs
- ReferentialConstraint.cs
- SspiHelper.cs
- FrameSecurityDescriptor.cs
- TableLayout.cs
- CodeTypeParameter.cs
- XmlTextReader.cs
- SecurityPermission.cs
- SemaphoreSecurity.cs
- XNodeSchemaApplier.cs
- RawAppCommandInputReport.cs
- Deflater.cs
- EncryptRequest.cs
- CompModSwitches.cs
- TextDecorationUnitValidation.cs
- Visual3DCollection.cs
- UdpUtility.cs
- PreparingEnlistment.cs
- DbException.cs
- ActivitiesCollection.cs
- WebReferencesBuildProvider.cs
- SplayTreeNode.cs
- FileLogRecordHeader.cs
- Encoder.cs
- WindowsListViewGroup.cs
- CallSiteHelpers.cs
- InvokeBinder.cs
- Camera.cs
- PKCS1MaskGenerationMethod.cs
- WebMessageFormatHelper.cs
- LogPolicy.cs
- DesignerSerializationOptionsAttribute.cs
- DesignObjectWrapper.cs
- WebServiceClientProxyGenerator.cs
- ToolStripPanel.cs
- ServiceOperation.cs
- util.cs
- XmlSchemaInfo.cs
- WindowsFormsHelpers.cs
- HMACSHA1.cs
- CodeCatchClauseCollection.cs