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
- HitTestWithPointDrawingContextWalker.cs
- XamlHttpHandlerFactory.cs
- InstanceStore.cs
- TextTreeRootNode.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- WebConvert.cs
- XmlSchemaSimpleTypeUnion.cs
- Vertex.cs
- ModelItemKeyValuePair.cs
- DefaultAuthorizationContext.cs
- TemplateLookupAction.cs
- RefreshEventArgs.cs
- MiniConstructorInfo.cs
- BaseParagraph.cs
- TextWriterTraceListener.cs
- OperationAbortedException.cs
- ListViewItem.cs
- Image.cs
- XPathNode.cs
- BindingExpressionUncommonField.cs
- RegexMatch.cs
- UniqueID.cs
- DataGridViewRowCollection.cs
- StorageConditionPropertyMapping.cs
- SpellerStatusTable.cs
- GZipDecoder.cs
- CommandBindingCollection.cs
- DispatcherExceptionFilterEventArgs.cs
- OletxEnlistment.cs
- __Filters.cs
- TimeIntervalCollection.cs
- SspiWrapper.cs
- PostBackTrigger.cs
- Path.cs
- PartialClassGenerationTaskInternal.cs
- TabControl.cs
- AssemblyAttributes.cs
- ImpersonationContext.cs
- UIElementParagraph.cs
- UriSchemeKeyedCollection.cs
- ImagingCache.cs
- DecimalFormatter.cs
- PeerEndPoint.cs
- NameScopePropertyAttribute.cs
- CharEntityEncoderFallback.cs
- DSACryptoServiceProvider.cs
- XmlSchemaSimpleContent.cs
- DataServiceClientException.cs
- SessionParameter.cs
- ConnectionPoolManager.cs
- OracleException.cs
- CompiledXpathExpr.cs
- AuthorizationRuleCollection.cs
- PersonalizableTypeEntry.cs
- CrossSiteScriptingValidation.cs
- DataSourceView.cs
- TrailingSpaceComparer.cs
- WebPartMenuStyle.cs
- GenerateScriptTypeAttribute.cs
- StringArrayConverter.cs
- StorageTypeMapping.cs
- CopyOfAction.cs
- DataGridViewComboBoxCell.cs
- ParserExtension.cs
- StdValidatorsAndConverters.cs
- HebrewCalendar.cs
- BrowserCapabilitiesFactory.cs
- ServiceInfoCollection.cs
- PageAsyncTask.cs
- Vector3DAnimationUsingKeyFrames.cs
- MessageHeaderDescription.cs
- IMembershipProvider.cs
- TraceRecord.cs
- GPRECTF.cs
- basemetadatamappingvisitor.cs
- WebPartRestoreVerb.cs
- EventPrivateKey.cs
- PointCollectionConverter.cs
- AssemblyBuilder.cs
- NodeLabelEditEvent.cs
- altserialization.cs
- HttpResponse.cs
- DataColumnChangeEvent.cs
- DialogResultConverter.cs
- EntityDataSourceColumn.cs
- XmlSchemaImporter.cs
- FileUtil.cs
- TreeViewImageKeyConverter.cs
- SqlPersonalizationProvider.cs
- BinHexEncoder.cs
- EntityObject.cs
- ToolboxItemFilterAttribute.cs
- SafeNativeMethodsCLR.cs
- IssuedSecurityTokenParameters.cs
- UTF32Encoding.cs
- DiscoveryDocumentSerializer.cs
- DrawingState.cs
- TouchEventArgs.cs
- BaseDataList.cs
- WebServiceReceive.cs