Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Activities / Role / WebWorkflowRole.cs / 1305376 / WebWorkflowRole.cs
using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Workflow.Runtime; using System.Workflow.Runtime.Hosting; using System.Web.Security; using System.Security.Principal; using System.Configuration.Provider; namespace System.Workflow.Activities { [Serializable] public class WebWorkflowRole : WorkflowRole { private string m_roleName; private string m_roleProvider; public override string Name { get { return this.m_roleName; } set { if (value == null) throw new ArgumentNullException("value"); this.m_roleName = value; } } public string RoleProvider { get { return this.m_roleProvider; } set { this.m_roleProvider = value; } } public WebWorkflowRole(string roleName) { if (null == roleName) { throw new ArgumentNullException("roleName"); } this.m_roleName = roleName; this.m_roleProvider = null; } public WebWorkflowRole(string roleName, string provider) { if (null == roleName) { throw new ArgumentNullException("roleName"); } this.m_roleName = roleName; this.m_roleProvider = provider; } public override IListGetIdentities() { List identities = new List (); System.Web.Security.RoleProvider rp = GetRoleProvider(); identities.AddRange(rp.GetUsersInRole(Name)); return identities; } public override bool IncludesIdentity(string identity) { System.Web.Security.RoleProvider rp = GetRoleProvider(); return rp.IsUserInRole(identity, Name); } private System.Web.Security.RoleProvider GetRoleProvider() { if (this.RoleProvider == null) return System.Web.Security.Roles.Provider; RoleProvider rp = Roles.Providers[this.RoleProvider]; if (rp == null) throw new ProviderException(SR.GetString(SR.Error_RoleProviderNotAvailableOrEnabled, this.RoleProvider)); return rp; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Workflow.Runtime; using System.Workflow.Runtime.Hosting; using System.Web.Security; using System.Security.Principal; using System.Configuration.Provider; namespace System.Workflow.Activities { [Serializable] public class WebWorkflowRole : WorkflowRole { private string m_roleName; private string m_roleProvider; public override string Name { get { return this.m_roleName; } set { if (value == null) throw new ArgumentNullException("value"); this.m_roleName = value; } } public string RoleProvider { get { return this.m_roleProvider; } set { this.m_roleProvider = value; } } public WebWorkflowRole(string roleName) { if (null == roleName) { throw new ArgumentNullException("roleName"); } this.m_roleName = roleName; this.m_roleProvider = null; } public WebWorkflowRole(string roleName, string provider) { if (null == roleName) { throw new ArgumentNullException("roleName"); } this.m_roleName = roleName; this.m_roleProvider = provider; } public override IList GetIdentities() { List identities = new List (); System.Web.Security.RoleProvider rp = GetRoleProvider(); identities.AddRange(rp.GetUsersInRole(Name)); return identities; } public override bool IncludesIdentity(string identity) { System.Web.Security.RoleProvider rp = GetRoleProvider(); return rp.IsUserInRole(identity, Name); } private System.Web.Security.RoleProvider GetRoleProvider() { if (this.RoleProvider == null) return System.Web.Security.Roles.Provider; RoleProvider rp = Roles.Providers[this.RoleProvider]; if (rp == null) throw new ProviderException(SR.GetString(SR.Error_RoleProviderNotAvailableOrEnabled, this.RoleProvider)); return rp; } } } // 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
- TextViewSelectionProcessor.cs
- AccessibleObject.cs
- sqlpipe.cs
- ChildDocumentBlock.cs
- DirectoryObjectSecurity.cs
- XmlElementCollection.cs
- DesignerSerializationOptionsAttribute.cs
- XPathDocumentBuilder.cs
- ParallelEnumerable.cs
- ToolStripOverflowButton.cs
- TextRangeEditLists.cs
- DataObject.cs
- WebControlAdapter.cs
- IteratorFilter.cs
- RelAssertionDirectKeyIdentifierClause.cs
- LassoHelper.cs
- TextSelection.cs
- DynamicResourceExtension.cs
- KeySplineConverter.cs
- RtfFormatStack.cs
- XslAstAnalyzer.cs
- DataGridColumnCollection.cs
- GroupBoxRenderer.cs
- StylusLogic.cs
- CodePrimitiveExpression.cs
- ResourceCodeDomSerializer.cs
- StylusPointProperty.cs
- DatagridviewDisplayedBandsData.cs
- ViewKeyConstraint.cs
- ImportCatalogPart.cs
- EdmEntityTypeAttribute.cs
- _ConnectionGroup.cs
- XmlSchemaSet.cs
- IgnoreDataMemberAttribute.cs
- ConstructorNeedsTagAttribute.cs
- RegexRunner.cs
- ModelServiceImpl.cs
- Point4DConverter.cs
- SecurityUtils.cs
- BooleanConverter.cs
- AutomationElement.cs
- Win32MouseDevice.cs
- WpfWebRequestHelper.cs
- XPathAncestorIterator.cs
- safemediahandle.cs
- DiscoveryServiceExtension.cs
- HttpApplication.cs
- HttpWebResponse.cs
- ThreadStaticAttribute.cs
- ControlValuePropertyAttribute.cs
- ContextDataSourceView.cs
- TypeInfo.cs
- TextAnchor.cs
- ConfigurationValidatorBase.cs
- IndexingContentUnit.cs
- UdpConstants.cs
- COM2AboutBoxPropertyDescriptor.cs
- RTTrackingProfile.cs
- DataServiceQueryOfT.cs
- UIPropertyMetadata.cs
- AddressAccessDeniedException.cs
- NativeMethods.cs
- MenuTracker.cs
- ActivityXamlServices.cs
- WSTransactionSection.cs
- ListControl.cs
- OutputCacheSettings.cs
- BaseTemplateBuildProvider.cs
- Size3D.cs
- XmlDocumentSurrogate.cs
- NegatedCellConstant.cs
- XmlWrappingWriter.cs
- formatstringdialog.cs
- CodeMemberMethod.cs
- ObjectListFieldCollection.cs
- Dictionary.cs
- NumberFunctions.cs
- SafeTimerHandle.cs
- InkCanvasSelection.cs
- Vector3DCollection.cs
- RegexCode.cs
- DeploymentExceptionMapper.cs
- RayMeshGeometry3DHitTestResult.cs
- ArcSegment.cs
- CompositeCollection.cs
- StateRuntime.cs
- BigInt.cs
- DeferredTextReference.cs
- CustomErrorsSectionWrapper.cs
- EventProviderBase.cs
- GroupItem.cs
- CopyOfAction.cs
- HashSetDebugView.cs
- EditingCommands.cs
- ObfuscateAssemblyAttribute.cs
- TextDecorationCollection.cs
- Message.cs
- BuildProvider.cs
- CodeExpressionCollection.cs
- DataSourceGroupCollection.cs