Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ProxyHelper.cs
- RoleBoolean.cs
- StackBuilderSink.cs
- JavascriptXmlWriterWrapper.cs
- DeploymentSection.cs
- ItemType.cs
- FixedSOMImage.cs
- SymbolPair.cs
- Rect3DValueSerializer.cs
- PropertyCondition.cs
- ServiceEndpointAssociationProvider.cs
- ResourceDisplayNameAttribute.cs
- FrameworkObject.cs
- PrintingPermissionAttribute.cs
- Executor.cs
- CommandHelpers.cs
- SystemWebExtensionsSectionGroup.cs
- WebResourceUtil.cs
- ProtocolsSection.cs
- TemplateXamlParser.cs
- ReachSerializableProperties.cs
- WaitHandle.cs
- ListViewAutomationPeer.cs
- WCFBuildProvider.cs
- ListenerElementsCollection.cs
- EncryptedKeyIdentifierClause.cs
- EmptyWithCancelationCheckWorkItem.cs
- XmlParserContext.cs
- LinkConverter.cs
- IIS7WorkerRequest.cs
- GeneralTransform.cs
- GridViewSelectEventArgs.cs
- SendAgentStatusRequest.cs
- SchemaDeclBase.cs
- Convert.cs
- Properties.cs
- DataGridViewColumnConverter.cs
- IsolatedStorageFile.cs
- PageCatalogPart.cs
- EventHandlerList.cs
- StringFunctions.cs
- DataFieldEditor.cs
- ConditionalExpression.cs
- CodeTypeMember.cs
- NativeMethods.cs
- DispatchChannelSink.cs
- WebPartConnectionsDisconnectVerb.cs
- SafeNativeMethods.cs
- SoapMessage.cs
- TextFormatter.cs
- OnOperation.cs
- smtpconnection.cs
- LightweightEntityWrapper.cs
- DbDataReader.cs
- DragAssistanceManager.cs
- ProtocolsConfigurationHandler.cs
- Query.cs
- Helper.cs
- ScrollProperties.cs
- Typography.cs
- PrePostDescendentsWalker.cs
- AppDomainUnloadedException.cs
- TextViewSelectionProcessor.cs
- CustomValidator.cs
- QuerySetOp.cs
- DescendentsWalker.cs
- AssociationTypeEmitter.cs
- LinqTreeNodeEvaluator.cs
- EntitySqlQueryCacheKey.cs
- ImportCatalogPart.cs
- BigInt.cs
- Win32Native.cs
- MessageAction.cs
- IisTraceListener.cs
- TextInfo.cs
- RequestCache.cs
- ManagementEventWatcher.cs
- Model3DGroup.cs
- PathTooLongException.cs
- QilFunction.cs
- AutomationProperties.cs
- Executor.cs
- TemplateParser.cs
- Logging.cs
- Collection.cs
- Slider.cs
- __FastResourceComparer.cs
- _UncName.cs
- SqlUtils.cs
- ClientSideQueueItem.cs
- ExpressionBindingCollection.cs
- UIElementCollection.cs
- XsdDateTime.cs
- GenericRootAutomationPeer.cs
- QueryOptionExpression.cs
- DefaultBinder.cs
- StyleCollection.cs
- QueryInterceptorAttribute.cs
- TextRangeSerialization.cs
- ConnectionsZoneDesigner.cs