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
- WasNotInstalledException.cs
- AuthenticationService.cs
- IdnElement.cs
- MenuItemAutomationPeer.cs
- ChannelPool.cs
- XamlVector3DCollectionSerializer.cs
- DiscreteKeyFrames.cs
- TreeNodeStyle.cs
- CompressEmulationStream.cs
- ProgramNode.cs
- SymLanguageType.cs
- PrintController.cs
- ResourceSet.cs
- MemberInfoSerializationHolder.cs
- GeneralTransform3DTo2DTo3D.cs
- invalidudtexception.cs
- PropertyGrid.cs
- IDReferencePropertyAttribute.cs
- XmlTextReaderImplHelpers.cs
- ContextMenuStrip.cs
- CommonDialog.cs
- LockedActivityGlyph.cs
- XPathArrayIterator.cs
- BoolExpr.cs
- ImageListUtils.cs
- InputLanguageProfileNotifySink.cs
- ExpressionBindingCollection.cs
- ToggleButtonAutomationPeer.cs
- Double.cs
- AssemblyBuilder.cs
- ReflectionPermission.cs
- control.ime.cs
- Quack.cs
- DataGridViewColumnHeaderCell.cs
- XmlKeywords.cs
- EncodingDataItem.cs
- XmlDataDocument.cs
- Win32Exception.cs
- RegionIterator.cs
- AuthorizationRule.cs
- Attributes.cs
- CDSsyncETWBCLProvider.cs
- InfoCardXmlSerializer.cs
- WindowsGrip.cs
- ListView.cs
- ScrollData.cs
- filewebrequest.cs
- RepeaterItem.cs
- SigningCredentials.cs
- UniqueSet.cs
- OptimizedTemplateContent.cs
- SqlFacetAttribute.cs
- RichTextBox.cs
- VirtualDirectoryMapping.cs
- AddInController.cs
- XPathCompileException.cs
- Pkcs9Attribute.cs
- TiffBitmapDecoder.cs
- QueryResults.cs
- JpegBitmapDecoder.cs
- SystemWebSectionGroup.cs
- TraceProvider.cs
- MissingMemberException.cs
- BitmapImage.cs
- Mouse.cs
- WindowsRichEdit.cs
- RuleSettingsCollection.cs
- ResourceDefaultValueAttribute.cs
- CLRBindingWorker.cs
- _AuthenticationState.cs
- WebPartChrome.cs
- Freezable.cs
- BaseTransportHeaders.cs
- DataSourceView.cs
- ListControl.cs
- InvalidOperationException.cs
- XmlObjectSerializerContext.cs
- Nullable.cs
- DataGridViewTopRowAccessibleObject.cs
- TableHeaderCell.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- UIElement3D.cs
- ItemType.cs
- securestring.cs
- FormClosedEvent.cs
- TrackingProfileCache.cs
- Image.cs
- IdentityHolder.cs
- FileLoadException.cs
- UrlPath.cs
- NeutralResourcesLanguageAttribute.cs
- ProtocolElementCollection.cs
- LayoutTable.cs
- HierarchicalDataTemplate.cs
- TextStore.cs
- TraceContext.cs
- ToolStripSplitStackLayout.cs
- PointConverter.cs
- DbFunctionCommandTree.cs
- FileDialogPermission.cs