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
- PrincipalPermissionMode.cs
- CheckBoxRenderer.cs
- Helpers.cs
- HtmlShim.cs
- RuntimeCompatibilityAttribute.cs
- MarshalDirectiveException.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- BinaryUtilClasses.cs
- UrlPath.cs
- TileBrush.cs
- Nullable.cs
- SqlConnectionPoolProviderInfo.cs
- PageBreakRecord.cs
- FrugalMap.cs
- StateMachineDesignerPaint.cs
- VariableQuery.cs
- EventRoute.cs
- XmlUnspecifiedAttribute.cs
- DBDataPermissionAttribute.cs
- VectorAnimation.cs
- ThumbButtonInfo.cs
- XamlNamespaceHelper.cs
- SimpleType.cs
- SqlProviderServices.cs
- OptimizerPatterns.cs
- UnmanagedMemoryStreamWrapper.cs
- BoundsDrawingContextWalker.cs
- FunctionNode.cs
- CurrentTimeZone.cs
- DataTemplateSelector.cs
- DbConnectionClosed.cs
- ProfileSection.cs
- OrderedDictionary.cs
- TextRunProperties.cs
- ComplexPropertyEntry.cs
- BrowserInteropHelper.cs
- AdRotator.cs
- CounterSetInstance.cs
- ImageUrlEditor.cs
- _NegoState.cs
- UrlAuthFailedErrorFormatter.cs
- precedingsibling.cs
- TypeConverterAttribute.cs
- webclient.cs
- Rectangle.cs
- XmlAttributes.cs
- XmlILModule.cs
- ParentQuery.cs
- NamespaceCollection.cs
- RealizationDrawingContextWalker.cs
- ToolboxItem.cs
- NativeMethods.cs
- DataAdapter.cs
- _LoggingObject.cs
- FragmentQueryKB.cs
- ScrollBarRenderer.cs
- LayoutEditorPart.cs
- RepeatBehavior.cs
- HwndPanningFeedback.cs
- TimerElapsedEvenArgs.cs
- OracleDataReader.cs
- BamlTreeNode.cs
- CqlBlock.cs
- JpegBitmapEncoder.cs
- Identity.cs
- ComponentCollection.cs
- XmlAtomicValue.cs
- DropSource.cs
- CommandDesigner.cs
- DiscreteKeyFrames.cs
- BoundColumn.cs
- RegistrationServices.cs
- QueryMatcher.cs
- CompoundFileIOPermission.cs
- FixedTextSelectionProcessor.cs
- EdmPropertyAttribute.cs
- CodeDirectoryCompiler.cs
- DropShadowBitmapEffect.cs
- TypedTableBase.cs
- UriTemplateLiteralPathSegment.cs
- BoolExpr.cs
- XmlAttributes.cs
- RelationshipEndMember.cs
- DiagnosticEventProvider.cs
- WindowsGraphics2.cs
- Imaging.cs
- HandlerBase.cs
- BrushMappingModeValidation.cs
- OdbcParameter.cs
- InheritanceContextChangedEventManager.cs
- DrawingAttributes.cs
- RefType.cs
- BoolExpr.cs
- SqlTriggerContext.cs
- Bookmark.cs
- EntityKey.cs
- ContractCodeDomInfo.cs
- HuffCodec.cs
- NativeConfigurationLoader.cs
- StoryFragments.cs