Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DictionaryContent.cs
- VariableElement.cs
- TcpHostedTransportConfiguration.cs
- TypeInfo.cs
- Pens.cs
- QuestionEventArgs.cs
- TextDecorationLocationValidation.cs
- ConfigurationErrorsException.cs
- CapabilitiesPattern.cs
- TextReader.cs
- MenuStrip.cs
- StrokeCollectionConverter.cs
- SoapFault.cs
- RequestBringIntoViewEventArgs.cs
- Variable.cs
- UniqueConstraint.cs
- GridViewRow.cs
- SafeFindHandle.cs
- SimpleLine.cs
- IndexedSelectQueryOperator.cs
- WebBrowserProgressChangedEventHandler.cs
- ParameterToken.cs
- XmlSchemaAnyAttribute.cs
- TextRangeBase.cs
- CategoryNameCollection.cs
- SeparatorAutomationPeer.cs
- PageStatePersister.cs
- BulletChrome.cs
- baseaxisquery.cs
- Select.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- _StreamFramer.cs
- IWorkflowDebuggerService.cs
- FaultContractAttribute.cs
- Tokenizer.cs
- EventEntry.cs
- DataReceivedEventArgs.cs
- StyleModeStack.cs
- BinaryObjectReader.cs
- DataViewSettingCollection.cs
- ProcessHostConfigUtils.cs
- AbstractDataSvcMapFileLoader.cs
- DataList.cs
- ContentElement.cs
- WorkItem.cs
- PictureBox.cs
- RuleDefinitions.cs
- BitmapEncoder.cs
- SegmentInfo.cs
- ExpressionEditorSheet.cs
- GeneralTransform3DCollection.cs
- BindingList.cs
- EventData.cs
- BooleanStorage.cs
- PropertyGrid.cs
- DefaultValidator.cs
- TraceSection.cs
- FixedSchema.cs
- SettingsProviderCollection.cs
- DataViewManager.cs
- DesignRelation.cs
- ThemeableAttribute.cs
- TransformationRules.cs
- Splitter.cs
- DictionaryBase.cs
- GregorianCalendarHelper.cs
- BufferedStream.cs
- DocumentGridContextMenu.cs
- ExtenderProvidedPropertyAttribute.cs
- CustomCategoryAttribute.cs
- DataGridCellItemAutomationPeer.cs
- BaseComponentEditor.cs
- LinqDataSourceEditData.cs
- IArgumentProvider.cs
- PersistencePipeline.cs
- BufferedReceiveManager.cs
- ValueType.cs
- BinarySerializer.cs
- TypeBuilderInstantiation.cs
- _UncName.cs
- Debug.cs
- APCustomTypeDescriptor.cs
- AttachedPropertyMethodSelector.cs
- DrawingContext.cs
- FocusChangedEventArgs.cs
- BitmapCacheBrush.cs
- ClientScriptManager.cs
- StopRoutingHandler.cs
- ServicePoint.cs
- ListSourceHelper.cs
- DetailsViewUpdateEventArgs.cs
- StoreContentChangedEventArgs.cs
- RtfFormatStack.cs
- StringStorage.cs
- AlphabetConverter.cs
- BinaryEditor.cs
- InfoCardXmlSerializer.cs
- CalculatedColumn.cs
- WorkflowQueueInfo.cs
- IndependentlyAnimatedPropertyMetadata.cs