Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / security / system / security / permissions / storepermissionattribute.cs / 1305376 / storepermissionattribute.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // StorePermissionAttribute.cs // namespace System.Security.Permissions { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false )] [Serializable()] public sealed class StorePermissionAttribute : CodeAccessSecurityAttribute { StorePermissionFlags m_flags = StorePermissionFlags.NoFlags; public StorePermissionAttribute(SecurityAction action) : base(action) {} public StorePermissionFlags Flags { get { return m_flags; } set { StorePermission.VerifyFlags(value); m_flags = value; } } public bool CreateStore { get { return (m_flags & StorePermissionFlags.CreateStore) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.CreateStore : m_flags & ~StorePermissionFlags.CreateStore; } } public bool DeleteStore { get { return (m_flags & StorePermissionFlags.DeleteStore) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.DeleteStore : m_flags & ~StorePermissionFlags.DeleteStore; } } public bool EnumerateStores { get { return (m_flags & StorePermissionFlags.EnumerateStores) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.EnumerateStores : m_flags & ~StorePermissionFlags.EnumerateStores; } } public bool OpenStore { get { return (m_flags & StorePermissionFlags.OpenStore) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.OpenStore : m_flags & ~StorePermissionFlags.OpenStore; } } public bool AddToStore { get { return (m_flags & StorePermissionFlags.AddToStore) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.AddToStore : m_flags & ~StorePermissionFlags.AddToStore; } } public bool RemoveFromStore { get { return (m_flags & StorePermissionFlags.RemoveFromStore) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.RemoveFromStore : m_flags & ~StorePermissionFlags.RemoveFromStore; } } public bool EnumerateCertificates { get { return (m_flags & StorePermissionFlags.EnumerateCertificates) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.EnumerateCertificates : m_flags & ~StorePermissionFlags.EnumerateCertificates; } } public override IPermission CreatePermission() { if (Unrestricted) return new StorePermission(PermissionState.Unrestricted); else return new StorePermission(m_flags); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // StorePermissionAttribute.cs // namespace System.Security.Permissions { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false )] [Serializable()] public sealed class StorePermissionAttribute : CodeAccessSecurityAttribute { StorePermissionFlags m_flags = StorePermissionFlags.NoFlags; public StorePermissionAttribute(SecurityAction action) : base(action) {} public StorePermissionFlags Flags { get { return m_flags; } set { StorePermission.VerifyFlags(value); m_flags = value; } } public bool CreateStore { get { return (m_flags & StorePermissionFlags.CreateStore) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.CreateStore : m_flags & ~StorePermissionFlags.CreateStore; } } public bool DeleteStore { get { return (m_flags & StorePermissionFlags.DeleteStore) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.DeleteStore : m_flags & ~StorePermissionFlags.DeleteStore; } } public bool EnumerateStores { get { return (m_flags & StorePermissionFlags.EnumerateStores) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.EnumerateStores : m_flags & ~StorePermissionFlags.EnumerateStores; } } public bool OpenStore { get { return (m_flags & StorePermissionFlags.OpenStore) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.OpenStore : m_flags & ~StorePermissionFlags.OpenStore; } } public bool AddToStore { get { return (m_flags & StorePermissionFlags.AddToStore) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.AddToStore : m_flags & ~StorePermissionFlags.AddToStore; } } public bool RemoveFromStore { get { return (m_flags & StorePermissionFlags.RemoveFromStore) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.RemoveFromStore : m_flags & ~StorePermissionFlags.RemoveFromStore; } } public bool EnumerateCertificates { get { return (m_flags & StorePermissionFlags.EnumerateCertificates) != 0; } set { m_flags = value ? m_flags | StorePermissionFlags.EnumerateCertificates : m_flags & ~StorePermissionFlags.EnumerateCertificates; } } public override IPermission CreatePermission() { if (Unrestricted) return new StorePermission(PermissionState.Unrestricted); else return new StorePermission(m_flags); } } } // 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
- ScrollData.cs
- StreamAsIStream.cs
- Focus.cs
- LogWriteRestartAreaState.cs
- ContainerFilterService.cs
- RequiredFieldValidator.cs
- DataGridViewAccessibleObject.cs
- SolidColorBrush.cs
- AuthenticationService.cs
- UnsafeNativeMethods.cs
- SQLInt16.cs
- FeatureSupport.cs
- FixedDocument.cs
- GregorianCalendarHelper.cs
- GuidTagList.cs
- ValueUtilsSmi.cs
- Operator.cs
- ValidationPropertyAttribute.cs
- ServiceModelActivity.cs
- Span.cs
- ObjectQuery_EntitySqlExtensions.cs
- StaticDataManager.cs
- TypeAccessException.cs
- Opcode.cs
- KeysConverter.cs
- FontInfo.cs
- DecoderFallback.cs
- OutputCacheSection.cs
- BinaryObjectWriter.cs
- FlowLayoutPanel.cs
- Rect3DValueSerializer.cs
- TdsParameterSetter.cs
- Accessible.cs
- NeutralResourcesLanguageAttribute.cs
- SQLRoleProvider.cs
- ColorInterpolationModeValidation.cs
- TextTreeRootTextBlock.cs
- QueryTreeBuilder.cs
- StringDictionary.cs
- ConfigsHelper.cs
- UnsafeNativeMethods.cs
- Debugger.cs
- FieldBuilder.cs
- HebrewCalendar.cs
- Schedule.cs
- StateDesigner.Layouts.cs
- XmlAttributeAttribute.cs
- Trigger.cs
- PixelShader.cs
- GridViewAutomationPeer.cs
- CustomTypeDescriptor.cs
- HyperlinkAutomationPeer.cs
- SByteConverter.cs
- SchemaMapping.cs
- ProtocolReflector.cs
- ContextStaticAttribute.cs
- HijriCalendar.cs
- HttpListenerElement.cs
- BindableAttribute.cs
- AssertFilter.cs
- XmlExceptionHelper.cs
- Rotation3DAnimation.cs
- HwndHostAutomationPeer.cs
- MenuBindingsEditorForm.cs
- MulticastIPAddressInformationCollection.cs
- GeometryHitTestResult.cs
- TextEditorThreadLocalStore.cs
- ConfigXmlWhitespace.cs
- CommunicationObjectManager.cs
- MessageSecurityTokenVersion.cs
- OraclePermission.cs
- iisPickupDirectory.cs
- DiscoveryReferences.cs
- AssemblyContextControlItem.cs
- CmsInterop.cs
- _ProxyChain.cs
- TextRange.cs
- ResumeStoryboard.cs
- ControlIdConverter.cs
- BCryptSafeHandles.cs
- ClientSession.cs
- FillRuleValidation.cs
- DbExpressionBuilder.cs
- RuleInfoComparer.cs
- ServiceReflector.cs
- ThemeableAttribute.cs
- DataListItemEventArgs.cs
- XmlAnyAttributeAttribute.cs
- StrongNamePublicKeyBlob.cs
- EntityUtil.cs
- FocusManager.cs
- LinqDataSourceSelectEventArgs.cs
- GenerateScriptTypeAttribute.cs
- ToggleProviderWrapper.cs
- EventSinkHelperWriter.cs
- ImageResources.Designer.cs
- ScrollItemPattern.cs
- SqlBooleanizer.cs
- ListBindingConverter.cs
- activationcontext.cs