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
- TabControlDesigner.cs
- PropertyGeneratedEventArgs.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- WindowsListView.cs
- CompilationUtil.cs
- PropertyGroupDescription.cs
- ZipIOLocalFileBlock.cs
- Random.cs
- Debug.cs
- PrtCap_Reader.cs
- CryptoHandle.cs
- FixedStringLookup.cs
- ToolStripSplitStackLayout.cs
- ClientFormsIdentity.cs
- DataDocumentXPathNavigator.cs
- ToolStripDropDownItem.cs
- DataGridViewImageCell.cs
- ThreadAbortException.cs
- ComPlusServiceHost.cs
- ExtendedPropertyCollection.cs
- RowParagraph.cs
- SerializationStore.cs
- Vector3D.cs
- InheritanceRules.cs
- TextOutput.cs
- AutomationProperties.cs
- DefaultIfEmptyQueryOperator.cs
- ConditionBrowserDialog.cs
- DataGridViewEditingControlShowingEventArgs.cs
- DynamicRouteExpression.cs
- JumpItem.cs
- NativeMethods.cs
- StringUtil.cs
- CommonDialog.cs
- BinHexDecoder.cs
- SerializationObjectManager.cs
- CreateUserWizard.cs
- SqlSelectStatement.cs
- ImpersonateTokenRef.cs
- ContentIterators.cs
- Completion.cs
- SafeReversePInvokeHandle.cs
- FlowDocumentReaderAutomationPeer.cs
- X509Utils.cs
- BuildResultCache.cs
- PersistNameAttribute.cs
- odbcmetadatacollectionnames.cs
- ContentWrapperAttribute.cs
- WindowsGraphics2.cs
- NameScopePropertyAttribute.cs
- ListViewDeletedEventArgs.cs
- XmlEventCache.cs
- _NetworkingPerfCounters.cs
- PassportAuthentication.cs
- SafeProcessHandle.cs
- PseudoWebRequest.cs
- IChannel.cs
- SqlClientWrapperSmiStream.cs
- TypeDescriptionProvider.cs
- StorageFunctionMapping.cs
- RequestCachePolicy.cs
- _IPv6Address.cs
- MaskDesignerDialog.cs
- documentation.cs
- RemoteDebugger.cs
- HatchBrush.cs
- ConnectionOrientedTransportElement.cs
- SmiEventSink_DeferedProcessing.cs
- NameValueCollection.cs
- AllowedAudienceUriElementCollection.cs
- storagemappingitemcollection.viewdictionary.cs
- PopupControlService.cs
- AnchorEditor.cs
- ImageConverter.cs
- TextStore.cs
- ResourcePool.cs
- CoreSwitches.cs
- RtfControls.cs
- ImagingCache.cs
- Event.cs
- CurrencyWrapper.cs
- DataGridViewComboBoxCell.cs
- Win32.cs
- CreatingCookieEventArgs.cs
- DataControlFieldCell.cs
- OleDbEnumerator.cs
- AutomationAttributeInfo.cs
- HttpTransportManager.cs
- TimersDescriptionAttribute.cs
- _BufferOffsetSize.cs
- SliderAutomationPeer.cs
- ValidationError.cs
- WinFormsUtils.cs
- WhitespaceRule.cs
- FaultContext.cs
- NonBatchDirectoryCompiler.cs
- CryptoApi.cs
- Normalization.cs
- TableSectionStyle.cs
- PageContentCollection.cs