Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- SplayTreeNode.cs
- SymbolType.cs
- EncodingTable.cs
- Brush.cs
- ColorDialog.cs
- XXXInfos.cs
- ToolbarAUtomationPeer.cs
- EditorZoneBase.cs
- CellLabel.cs
- XmlILIndex.cs
- CodeChecksumPragma.cs
- __Filters.cs
- ChannelSinkStacks.cs
- AlignmentYValidation.cs
- PropertyChangedEventManager.cs
- LogFlushAsyncResult.cs
- SafeRsaProviderHandle.cs
- ProxyWebPartConnectionCollection.cs
- PartitionedDataSource.cs
- MediaContext.cs
- CompilationRelaxations.cs
- ActivationServices.cs
- EntityTransaction.cs
- ShaderRenderModeValidation.cs
- HtmlInputRadioButton.cs
- ResourceManagerWrapper.cs
- MetadataHelper.cs
- WindowsSysHeader.cs
- Ticks.cs
- EntityDataSourceSelectingEventArgs.cs
- ScrollBar.cs
- Transaction.cs
- SqlCachedBuffer.cs
- TextElement.cs
- TypefaceCollection.cs
- RuleElement.cs
- HashStream.cs
- StackSpiller.cs
- StorageEntitySetMapping.cs
- versioninfo.cs
- panel.cs
- SizeIndependentAnimationStorage.cs
- StringPropertyBuilder.cs
- AutomationPropertyInfo.cs
- ApplicationFileParser.cs
- IndexOutOfRangeException.cs
- mactripleDES.cs
- WebControl.cs
- BasicBrowserDialog.cs
- ResourcePermissionBase.cs
- ChannelServices.cs
- BoundColumn.cs
- LinqDataSourceContextEventArgs.cs
- DataServiceContext.cs
- PersianCalendar.cs
- ItemDragEvent.cs
- TypeForwardedToAttribute.cs
- InfoCardRequestException.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- DistinctQueryOperator.cs
- KeyPressEvent.cs
- VirtualDirectoryMappingCollection.cs
- ParameterCollectionEditor.cs
- OutputCacheSettings.cs
- TextSearch.cs
- GridViewUpdatedEventArgs.cs
- ActivityExecutionContextCollection.cs
- BindingSource.cs
- BuiltInExpr.cs
- HttpErrorTraceRecord.cs
- DataGrid.cs
- FormParameter.cs
- GreaterThan.cs
- listviewsubitemcollectioneditor.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- GridViewPageEventArgs.cs
- ScrollItemPatternIdentifiers.cs
- WindowsSecurityTokenAuthenticator.cs
- TraceSwitch.cs
- SoapAttributes.cs
- KeyboardEventArgs.cs
- CustomAttributeSerializer.cs
- DataServiceResponse.cs
- DesignerHierarchicalDataSourceView.cs
- DefaultValueAttribute.cs
- SqlServices.cs
- Bits.cs
- NotifyParentPropertyAttribute.cs
- TreeSet.cs
- Model3DGroup.cs
- XmlSerializer.cs
- CoordinationService.cs
- XPathCompileException.cs
- DynamicResourceExtensionConverter.cs
- invalidudtexception.cs
- AttributeProviderAttribute.cs
- NTAccount.cs
- BCLDebug.cs
- TraceHwndHost.cs
- ImageCodecInfoPrivate.cs