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
- ResourcePart.cs
- ValueType.cs
- WebPartVerb.cs
- DbSourceParameterCollection.cs
- RegisteredArrayDeclaration.cs
- DbBuffer.cs
- Number.cs
- AssertUtility.cs
- ArrayConverter.cs
- QuaternionAnimation.cs
- GridItemCollection.cs
- ProviderConnectionPointCollection.cs
- ReachPageContentSerializer.cs
- PostBackOptions.cs
- MsmqIntegrationBinding.cs
- BitmapEffectDrawingContextWalker.cs
- VariantWrapper.cs
- ToolStripContentPanel.cs
- SQLGuid.cs
- CFGGrammar.cs
- ScriptManagerProxy.cs
- TransformerInfo.cs
- ObjectDataSourceMethodEventArgs.cs
- ArglessEventHandlerProxy.cs
- JsonGlobals.cs
- SelectionRangeConverter.cs
- AtomicFile.cs
- ListViewCancelEventArgs.cs
- DataObjectEventArgs.cs
- XXXInfos.cs
- SmiMetaData.cs
- Tuple.cs
- TypeUnloadedException.cs
- HtmlInputPassword.cs
- LeaseManager.cs
- ConditionalAttribute.cs
- Visual3D.cs
- PassportAuthenticationModule.cs
- DataGridViewColumnEventArgs.cs
- StickyNote.cs
- ExpressionBindingCollection.cs
- PublishLicense.cs
- EventBuilder.cs
- CommandLibraryHelper.cs
- RecognizerInfo.cs
- StaticContext.cs
- RangeContentEnumerator.cs
- Region.cs
- MonthCalendar.cs
- VisualBasicDesignerHelper.cs
- Delay.cs
- HashJoinQueryOperatorEnumerator.cs
- TextAnchor.cs
- HtmlSelect.cs
- SqlTriggerAttribute.cs
- InputLangChangeRequestEvent.cs
- CodeThrowExceptionStatement.cs
- FormsIdentity.cs
- DataGridPreparingCellForEditEventArgs.cs
- ComponentEditorForm.cs
- ProofTokenCryptoHandle.cs
- IgnoreSectionHandler.cs
- PaintValueEventArgs.cs
- XmlExceptionHelper.cs
- Nullable.cs
- TCEAdapterGenerator.cs
- ReadOnlyCollectionBase.cs
- NavigationProperty.cs
- TrackingProfile.cs
- ClientApiGenerator.cs
- Button.cs
- EventPropertyMap.cs
- ServiceNotStartedException.cs
- WebPartMenu.cs
- PopupRoot.cs
- ApplicationProxyInternal.cs
- SystemDropShadowChrome.cs
- ValidationRule.cs
- SqlProcedureAttribute.cs
- ButtonBase.cs
- TextElementCollectionHelper.cs
- TypeValidationEventArgs.cs
- ReceiveReply.cs
- ScriptingRoleServiceSection.cs
- GiveFeedbackEvent.cs
- GridViewRowCollection.cs
- Page.cs
- ConfigurationManager.cs
- OSEnvironmentHelper.cs
- DecoderNLS.cs
- DateTimeFormat.cs
- TextElementEnumerator.cs
- NavigationFailedEventArgs.cs
- DoubleLinkList.cs
- ImpersonationContext.cs
- ManifestBasedResourceGroveler.cs
- UpdateManifestForBrowserApplication.cs
- WindowsAuthenticationModule.cs
- PhoneCallDesigner.cs
- ApplicationSecurityManager.cs