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
- RectIndependentAnimationStorage.cs
- DataTableClearEvent.cs
- _ScatterGatherBuffers.cs
- UserNameSecurityTokenAuthenticator.cs
- ArrayHelper.cs
- GridViewRowCollection.cs
- TypeSemantics.cs
- TextDecorations.cs
- Convert.cs
- PropertyNames.cs
- BitmapEffectInput.cs
- ContainerParaClient.cs
- Sql8ConformanceChecker.cs
- TdsParserStateObject.cs
- CheckBoxPopupAdapter.cs
- sitestring.cs
- Configuration.cs
- Policy.cs
- UnsafeNativeMethodsCLR.cs
- EntityTypeEmitter.cs
- TextPatternIdentifiers.cs
- Pair.cs
- configsystem.cs
- AlternateView.cs
- StylusSystemGestureEventArgs.cs
- CorrelationInitializer.cs
- DataGridViewBindingCompleteEventArgs.cs
- DataSourceProvider.cs
- ExceptionUtil.cs
- BoundField.cs
- BindingCollection.cs
- DataSourceExpression.cs
- MinimizableAttributeTypeConverter.cs
- SqlCommandBuilder.cs
- newinstructionaction.cs
- EmulateRecognizeCompletedEventArgs.cs
- ExtensionQuery.cs
- EditCommandColumn.cs
- XmlDownloadManager.cs
- cache.cs
- MediaCommands.cs
- Splitter.cs
- X509Utils.cs
- AddInStore.cs
- WpfXamlMember.cs
- UITypeEditors.cs
- FtpRequestCacheValidator.cs
- DataGridViewCellValueEventArgs.cs
- NonSerializedAttribute.cs
- TextFragmentEngine.cs
- StringComparer.cs
- MruCache.cs
- Assembly.cs
- BamlLocalizationDictionary.cs
- MenuItemBinding.cs
- FixedTextPointer.cs
- NamespaceList.cs
- CompositeFontInfo.cs
- ScriptIgnoreAttribute.cs
- DataSourceView.cs
- ReachObjectContext.cs
- PathSegment.cs
- XPathParser.cs
- PopupRootAutomationPeer.cs
- DataGridViewComboBoxCell.cs
- PeerToPeerException.cs
- FrameworkElement.cs
- NullReferenceException.cs
- DoubleConverter.cs
- SerialErrors.cs
- WebServiceHandler.cs
- ArrayItemValue.cs
- QueryRewriter.cs
- DbModificationCommandTree.cs
- BeginEvent.cs
- IteratorFilter.cs
- xmlsaver.cs
- PerfCounterSection.cs
- SByte.cs
- SoapAttributeAttribute.cs
- PropertyEmitter.cs
- PageTheme.cs
- TableMethodGenerator.cs
- IPEndPointCollection.cs
- RectAnimation.cs
- CanExecuteRoutedEventArgs.cs
- MailDefinition.cs
- MultiBindingExpression.cs
- DataViewListener.cs
- ProfileSection.cs
- Line.cs
- CallbackWrapper.cs
- ListMarkerLine.cs
- UIElementAutomationPeer.cs
- AuthorizationSection.cs
- IndexedString.cs
- IgnoreSectionHandler.cs
- ScriptingScriptResourceHandlerSection.cs
- _LocalDataStore.cs
- TemplateXamlTreeBuilder.cs