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
- FontFamilyConverter.cs
- XmlWrappingReader.cs
- DispatcherExceptionFilterEventArgs.cs
- AssociationSetMetadata.cs
- ResourceDictionary.cs
- EpmSyndicationContentDeSerializer.cs
- GraphicsState.cs
- SimpleType.cs
- GridItemCollection.cs
- SessionEndingEventArgs.cs
- ValidationException.cs
- WorkflowMessageEventArgs.cs
- InputReferenceExpression.cs
- PageThemeCodeDomTreeGenerator.cs
- SqlNodeTypeOperators.cs
- MediaPlayer.cs
- LogEntryHeaderv1Deserializer.cs
- ScriptManager.cs
- FileIOPermission.cs
- TransportationConfigurationTypeInstallComponent.cs
- RequestCachingSection.cs
- ClipboardProcessor.cs
- Pair.cs
- CreateUserWizard.cs
- CodeMemberProperty.cs
- FunctionDetailsReader.cs
- CustomPopupPlacement.cs
- UrlMappingCollection.cs
- ConfigurationElement.cs
- SettingsContext.cs
- DbConnectionOptions.cs
- VirtualPathProvider.cs
- UnmanagedMemoryStream.cs
- ReadOnlyCollectionBase.cs
- DBCommandBuilder.cs
- SettingsBase.cs
- EllipseGeometry.cs
- DataContractSerializerMessageContractImporter.cs
- PageFunction.cs
- XmlSchemaException.cs
- ThemeableAttribute.cs
- Confirm.cs
- Blend.cs
- MetadataItem.cs
- VerificationAttribute.cs
- RootBuilder.cs
- _NativeSSPI.cs
- userdatakeys.cs
- WSAddressing10ProblemHeaderQNameFault.cs
- StringAnimationUsingKeyFrames.cs
- UpdateDelegates.Generated.cs
- RootBuilder.cs
- MetadataUtilsSmi.cs
- AsyncCompletedEventArgs.cs
- Attributes.cs
- NavigationCommands.cs
- HandlerBase.cs
- ExtendedProtectionPolicy.cs
- WebHttpEndpointElement.cs
- PriorityChain.cs
- TemplateBindingExpressionConverter.cs
- SqlBuffer.cs
- CalloutQueueItem.cs
- XmlKeywords.cs
- PageThemeParser.cs
- TriggerBase.cs
- TextDecoration.cs
- Tool.cs
- configsystem.cs
- WebPartEditorOkVerb.cs
- ResXResourceReader.cs
- MessageBuffer.cs
- RsaKeyGen.cs
- MenuEventArgs.cs
- BaseTypeViewSchema.cs
- UInt32Storage.cs
- MessageQueueCriteria.cs
- ConsoleTraceListener.cs
- DataGridCell.cs
- WorkflowDispatchContext.cs
- ValidateNames.cs
- OutputScopeManager.cs
- OdbcEnvironment.cs
- HScrollProperties.cs
- DependencyObjectPropertyDescriptor.cs
- PeerNameRecord.cs
- _NTAuthentication.cs
- WindowsGraphics2.cs
- RegexCompiler.cs
- GregorianCalendar.cs
- DetailsViewModeEventArgs.cs
- CallContext.cs
- PageAdapter.cs
- SoapElementAttribute.cs
- TransformGroup.cs
- SolidColorBrush.cs
- PhysicalOps.cs
- ImplicitInputBrush.cs
- SqlFlattener.cs
- FloaterBaseParagraph.cs