Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- BaseComponentEditor.cs
- XmlSchemaImport.cs
- AutoCompleteStringCollection.cs
- ThemeDictionaryExtension.cs
- HitTestParameters3D.cs
- SR.cs
- StyleHelper.cs
- ProfilePropertySettings.cs
- OpenFileDialog.cs
- CodeIndexerExpression.cs
- WebRequest.cs
- dbenumerator.cs
- AuthenticationModuleElementCollection.cs
- PropertyGridView.cs
- DateTimeStorage.cs
- mactripleDES.cs
- AppAction.cs
- MetabaseServerConfig.cs
- Math.cs
- CatalogPartChrome.cs
- LoginAutoFormat.cs
- SecurityException.cs
- ReliableMessagingVersionConverter.cs
- WebPartConnection.cs
- XmlSchemaFacet.cs
- KeyEventArgs.cs
- ArrayHelper.cs
- DependencyProperty.cs
- SerialReceived.cs
- ContourSegment.cs
- BindingRestrictions.cs
- TypeCollectionDesigner.xaml.cs
- KeyValuePairs.cs
- HttpRequestCacheValidator.cs
- DocumentSequenceHighlightLayer.cs
- ProcessStartInfo.cs
- SchemaTableOptionalColumn.cs
- SafeCryptHandles.cs
- XamlInt32CollectionSerializer.cs
- XmlSchemaAnyAttribute.cs
- CommunicationObjectManager.cs
- RequiredAttributeAttribute.cs
- WinOEToolBoxItem.cs
- FormViewRow.cs
- InfoCardKeyedHashAlgorithm.cs
- ListViewUpdateEventArgs.cs
- TemplateApplicationHelper.cs
- SafeSystemMetrics.cs
- InternalSafeNativeMethods.cs
- XslCompiledTransform.cs
- HTTPNotFoundHandler.cs
- PanningMessageFilter.cs
- Configuration.cs
- EntityAdapter.cs
- ScriptServiceAttribute.cs
- ExpressionCopier.cs
- _HTTPDateParse.cs
- Size3D.cs
- HotSpotCollection.cs
- FixedLineResult.cs
- UInt32Storage.cs
- ToolStripDropTargetManager.cs
- CfgParser.cs
- RemotingAttributes.cs
- LogicalExpr.cs
- ReflectEventDescriptor.cs
- PerspectiveCamera.cs
- SemanticResultValue.cs
- EraserBehavior.cs
- MimeReflector.cs
- TransactionsSectionGroup.cs
- TlsnegoTokenProvider.cs
- Convert.cs
- WindowsContainer.cs
- SourceFileBuildProvider.cs
- StorageComplexPropertyMapping.cs
- ScriptResourceInfo.cs
- WindowInteractionStateTracker.cs
- SqlTrackingService.cs
- Point4DConverter.cs
- SHA256.cs
- printdlgexmarshaler.cs
- ArrangedElementCollection.cs
- LoadMessageLogger.cs
- IndexingContentUnit.cs
- FlowStep.cs
- RelationshipDetailsRow.cs
- XmlCodeExporter.cs
- EntityConnectionStringBuilder.cs
- PassportAuthentication.cs
- TextAutomationPeer.cs
- TableLayoutPanelCellPosition.cs
- MultilineStringConverter.cs
- CheckBox.cs
- IntersectQueryOperator.cs
- CodeDomSerializationProvider.cs
- PersonalizableTypeEntry.cs
- PageVisual.cs
- ExpressionConverter.cs
- ListViewCancelEventArgs.cs