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
- WebPartPersonalization.cs
- PageParserFilter.cs
- SafeTokenHandle.cs
- ServiceDesigner.cs
- AssemblyAttributes.cs
- CodeFieldReferenceExpression.cs
- UIPermission.cs
- ReflectionUtil.cs
- HMACSHA512.cs
- UICuesEvent.cs
- DriveInfo.cs
- ContextBase.cs
- InternalBase.cs
- ErrorTableItemStyle.cs
- Matrix3D.cs
- DataGridViewToolTip.cs
- GrammarBuilderRuleRef.cs
- CopyCodeAction.cs
- SymbolEqualComparer.cs
- MenuItem.cs
- ValidationHelper.cs
- Misc.cs
- EngineSite.cs
- ListItemCollection.cs
- SessionMode.cs
- FileVersion.cs
- ActivityInfo.cs
- EntityDataSourceContainerNameItem.cs
- Permission.cs
- FunctionDescription.cs
- NotifyCollectionChangedEventArgs.cs
- SortedList.cs
- _PooledStream.cs
- RtType.cs
- PropVariant.cs
- MergePropertyDescriptor.cs
- OrthographicCamera.cs
- SpotLight.cs
- UnsafeNativeMethodsPenimc.cs
- ContentTextAutomationPeer.cs
- MarshalByValueComponent.cs
- ForeignKeyConstraint.cs
- PackagingUtilities.cs
- MenuCommand.cs
- WebConfigurationManager.cs
- SimpleBitVector32.cs
- WindowsListViewGroupSubsetLink.cs
- HtmlHead.cs
- ExceptionUtil.cs
- PropertyEmitter.cs
- HttpConfigurationSystem.cs
- HyperlinkAutomationPeer.cs
- InvalidateEvent.cs
- DropDownButton.cs
- ProxyGenerator.cs
- AuthorizationRule.cs
- ReflectionTypeLoadException.cs
- BasicExpandProvider.cs
- TreeWalkHelper.cs
- CopyAction.cs
- CacheSection.cs
- UnsafeNativeMethods.cs
- ObjectViewListener.cs
- ConcurrentQueue.cs
- ClipboardProcessor.cs
- DataFormats.cs
- NavigationHelper.cs
- HttpModulesInstallComponent.cs
- DateTimeFormatInfoScanner.cs
- ConnectionInterfaceCollection.cs
- ChangePassword.cs
- SmiConnection.cs
- ToolStripMenuItemDesigner.cs
- AuthenticationService.cs
- DataGridViewRowPostPaintEventArgs.cs
- ReadWriteSpinLock.cs
- OleDbSchemaGuid.cs
- CodeIdentifier.cs
- DragEventArgs.cs
- StringFormat.cs
- DbDataSourceEnumerator.cs
- ExitEventArgs.cs
- Environment.cs
- ConcurrentDictionary.cs
- TdsParserSessionPool.cs
- Error.cs
- DataListItemCollection.cs
- DecimalAnimationBase.cs
- CommandManager.cs
- FontInfo.cs
- BufferedGraphicsContext.cs
- WinHttpWebProxyFinder.cs
- ReflectionHelper.cs
- EraserBehavior.cs
- StaticContext.cs
- DateTimeSerializationSection.cs
- CodeObjectCreateExpression.cs
- ChainOfResponsibility.cs
- DirectoryLocalQuery.cs
- TableItemPatternIdentifiers.cs