Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SourceChangedEventArgs.cs
- DashStyle.cs
- HtmlMeta.cs
- ContentElement.cs
- WebAdminConfigurationHelper.cs
- RemotingConfiguration.cs
- CachedTypeface.cs
- Pool.cs
- PerformanceCountersElement.cs
- ReadWriteObjectLock.cs
- ResXDataNode.cs
- RegexMatchCollection.cs
- ProxyManager.cs
- RegexEditorDialog.cs
- DesignerSerializerAttribute.cs
- DataGridViewCellLinkedList.cs
- _HTTPDateParse.cs
- AnimationException.cs
- KeyboardEventArgs.cs
- PageRequestManager.cs
- SelectionEditingBehavior.cs
- Int64Converter.cs
- ClientUtils.cs
- TokenDescriptor.cs
- DesignerCalendarAdapter.cs
- KeyPressEvent.cs
- IsolatedStorageFileStream.cs
- StrongNameUtility.cs
- LineSegment.cs
- PageAsyncTask.cs
- SystemWebExtensionsSectionGroup.cs
- ExpressionPrefixAttribute.cs
- DataSourceProvider.cs
- SqlMethods.cs
- DynamicValueConverter.cs
- SelectionRange.cs
- CodeBlockBuilder.cs
- TemplatePartAttribute.cs
- DesignerActionUI.cs
- XamlRtfConverter.cs
- RSAOAEPKeyExchangeDeformatter.cs
- RequestQueryProcessor.cs
- StyleXamlParser.cs
- OpenFileDialog.cs
- ILGenerator.cs
- XmlElementList.cs
- ServerValidateEventArgs.cs
- WebPartTransformerCollection.cs
- ComEventsHelper.cs
- DependencyObjectPropertyDescriptor.cs
- TabControlEvent.cs
- MethodCallTranslator.cs
- ListItemCollection.cs
- SmiXetterAccessMap.cs
- DataContractSet.cs
- SqlDataSourceQueryEditor.cs
- Region.cs
- XPathSingletonIterator.cs
- CustomAttributeFormatException.cs
- HostTimeoutsElement.cs
- PrimitiveXmlSerializers.cs
- SingleTagSectionHandler.cs
- ListMarkerSourceInfo.cs
- MediaEntryAttribute.cs
- querybuilder.cs
- Rule.cs
- ButtonBaseAdapter.cs
- EncodingNLS.cs
- Tracking.cs
- FillBehavior.cs
- XmlSchemaDocumentation.cs
- AssemblyBuilderData.cs
- SiteMapNode.cs
- XmlDocumentSerializer.cs
- SocketElement.cs
- documentation.cs
- LineUtil.cs
- VarRefManager.cs
- CodeDelegateCreateExpression.cs
- WebBrowserBase.cs
- Main.cs
- MethodBuilder.cs
- PagePropertiesChangingEventArgs.cs
- ItemList.cs
- _DomainName.cs
- Graph.cs
- SerialErrors.cs
- WebPartConnectionsEventArgs.cs
- AssemblyBuilderData.cs
- WaitHandle.cs
- InProcStateClientManager.cs
- ValueUnavailableException.cs
- ContextQuery.cs
- CompilerResults.cs
- ExpressionBindingCollection.cs
- ManagementNamedValueCollection.cs
- Graph.cs
- SamlEvidence.cs
- CodeTypeDelegate.cs
- XPathNodeInfoAtom.cs