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
- ProjectionQueryOptionExpression.cs
- XmlElement.cs
- SqlParameterCollection.cs
- ProfileService.cs
- UpdateEventArgs.cs
- TransformationRules.cs
- PolyQuadraticBezierSegment.cs
- Stylesheet.cs
- CultureInfoConverter.cs
- DataView.cs
- GridViewSortEventArgs.cs
- UpdateTranslator.cs
- NativeObjectSecurity.cs
- IISMapPath.cs
- UnicodeEncoding.cs
- FileDetails.cs
- CheckoutException.cs
- RegisteredScript.cs
- DateTimeSerializationSection.cs
- SignHashRequest.cs
- GridViewDeleteEventArgs.cs
- AutomationProperty.cs
- DetailsViewRowCollection.cs
- _ScatterGatherBuffers.cs
- CapabilitiesAssignment.cs
- EncryptedKey.cs
- Lasso.cs
- keycontainerpermission.cs
- CounterSampleCalculator.cs
- Privilege.cs
- DoubleCollection.cs
- ConstructorBuilder.cs
- OracleBFile.cs
- CompoundFileDeflateTransform.cs
- COAUTHIDENTITY.cs
- SystemParameters.cs
- FormViewRow.cs
- MailAddress.cs
- SQLUtility.cs
- CompiledQuery.cs
- SerializationException.cs
- MessageRpc.cs
- AssemblyInfo.cs
- Parser.cs
- RemoteX509AsymmetricSecurityKey.cs
- QueryContinueDragEventArgs.cs
- backend.cs
- ListViewGroupItemCollection.cs
- PlatformNotSupportedException.cs
- XmlExpressionDumper.cs
- IItemContainerGenerator.cs
- SR.cs
- ContainerUIElement3D.cs
- AvTrace.cs
- SecurityTokenAuthenticator.cs
- GridItem.cs
- HandleExceptionArgs.cs
- RegexNode.cs
- TypeConverterHelper.cs
- CqlIdentifiers.cs
- StylusPointPropertyInfoDefaults.cs
- CmsUtils.cs
- FontCacheLogic.cs
- GiveFeedbackEvent.cs
- SettingsPropertyCollection.cs
- KeyValueInternalCollection.cs
- ToolbarAUtomationPeer.cs
- CompModHelpers.cs
- InkCanvasInnerCanvas.cs
- SimpleHandlerFactory.cs
- HtmlInputButton.cs
- HostingEnvironmentSection.cs
- COM2TypeInfoProcessor.cs
- ObjectItemNoOpAssemblyLoader.cs
- CacheChildrenQuery.cs
- ModuleBuilderData.cs
- VisualBrush.cs
- InplaceBitmapMetadataWriter.cs
- DataSourceHelper.cs
- SqlReferenceCollection.cs
- ellipse.cs
- WebPartConnectionsDisconnectVerb.cs
- ExportException.cs
- cookie.cs
- DeflateStreamAsyncResult.cs
- URLString.cs
- WebScriptMetadataFormatter.cs
- XmlArrayItemAttribute.cs
- PersonalizablePropertyEntry.cs
- VirtualizingPanel.cs
- TargetPerspective.cs
- PrintDocument.cs
- SqlCaseSimplifier.cs
- DeleteWorkflowOwnerCommand.cs
- XmlHierarchicalEnumerable.cs
- WithStatement.cs
- GenericEnumerator.cs
- UserNameServiceElement.cs
- TextRangeEditLists.cs
- TableCellCollection.cs