Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / 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. //------------------------------------------------------------------------------ //// 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
- PriorityChain.cs
- OneOfScalarConst.cs
- ByteRangeDownloader.cs
- CommandDesigner.cs
- GenericQueueSurrogate.cs
- WebPartsPersonalization.cs
- securitymgrsite.cs
- SqlNotificationEventArgs.cs
- StylusPointPropertyInfoDefaults.cs
- ServiceOperation.cs
- DecryptedHeader.cs
- ParameterModifier.cs
- DataGridViewRowEventArgs.cs
- TransformerInfoCollection.cs
- SqlUserDefinedAggregateAttribute.cs
- TextServicesPropertyRanges.cs
- InputScopeManager.cs
- WindowsToolbar.cs
- DateTime.cs
- LoadRetryHandler.cs
- ContainerCodeDomSerializer.cs
- WindowCollection.cs
- ImportCatalogPart.cs
- FusionWrap.cs
- GridViewRow.cs
- ConnectionPointCookie.cs
- CacheSection.cs
- BinaryParser.cs
- ProviderMetadata.cs
- DataObjectPastingEventArgs.cs
- StylusPointPropertyUnit.cs
- Converter.cs
- MouseButtonEventArgs.cs
- SpinWait.cs
- FormsAuthenticationEventArgs.cs
- UndoManager.cs
- ThemeDirectoryCompiler.cs
- ADRole.cs
- LeaseManager.cs
- SqlClientMetaDataCollectionNames.cs
- DynamicMetaObjectBinder.cs
- MetabaseReader.cs
- DataGridViewColumnHeaderCell.cs
- WorkflowOperationContext.cs
- CurrentChangingEventManager.cs
- TextFindEngine.cs
- HtmlControlPersistable.cs
- TextStore.cs
- FlowDocumentPageViewerAutomationPeer.cs
- TransactedReceiveData.cs
- Slider.cs
- SecurityContext.cs
- GenericParameterDataContract.cs
- DiagnosticsElement.cs
- NativeMethods.cs
- AsyncOperationLifetimeManager.cs
- EdmScalarPropertyAttribute.cs
- Propagator.Evaluator.cs
- AuthenticationException.cs
- ErrorStyle.cs
- WmlLinkAdapter.cs
- PointCollectionValueSerializer.cs
- UpdateCompiler.cs
- Label.cs
- XhtmlBasicFormAdapter.cs
- ProfileGroupSettingsCollection.cs
- SqlFunctionAttribute.cs
- QilStrConcat.cs
- PropertyGridEditorPart.cs
- TracePayload.cs
- TerminatorSinks.cs
- AttributeUsageAttribute.cs
- RemotingConfigParser.cs
- WebUtil.cs
- XmlWriterTraceListener.cs
- BeginStoryboard.cs
- SqlBulkCopyColumnMapping.cs
- ViewDesigner.cs
- XpsSerializerWriter.cs
- ConfigsHelper.cs
- CurrencyWrapper.cs
- NoPersistHandle.cs
- StringUtil.cs
- CircleHotSpot.cs
- LinkArea.cs
- OraclePermissionAttribute.cs
- ReadOnlyDataSource.cs
- GeneralTransform3DGroup.cs
- QueryOpcode.cs
- RelatedView.cs
- EncryptedPackageFilter.cs
- SpotLight.cs
- EncodingDataItem.cs
- SqlDataSourceView.cs
- DocumentViewerAutomationPeer.cs
- SizeAnimation.cs
- ResXResourceSet.cs
- ProcessHostFactoryHelper.cs
- TextSelectionHighlightLayer.cs
- TextOptions.cs