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
- Journaling.cs
- XPathNodeHelper.cs
- ProtocolsConfigurationEntry.cs
- Selection.cs
- LingerOption.cs
- X509CertificateValidationMode.cs
- QueryConverter.cs
- SchemaExporter.cs
- ScrollItemProviderWrapper.cs
- OptionalMessageQuery.cs
- XmlSchemaType.cs
- Rights.cs
- Preprocessor.cs
- LogLogRecordHeader.cs
- ContractComponent.cs
- XmlTextEncoder.cs
- ImageListStreamer.cs
- QueryExecutionOption.cs
- TableItemPatternIdentifiers.cs
- EventHandlerList.cs
- DocumentDesigner.cs
- CatalogPartChrome.cs
- precedingquery.cs
- ScrollEvent.cs
- FrameSecurityDescriptor.cs
- RuntimeConfigLKG.cs
- AvTraceFormat.cs
- XmlSchemaValidator.cs
- Configuration.cs
- PersonalizableAttribute.cs
- HttpRawResponse.cs
- DataControlLinkButton.cs
- CustomErrorsSectionWrapper.cs
- PropertyMap.cs
- WebContext.cs
- GridItemPattern.cs
- XmlSerializationWriter.cs
- ObjectDataSourceView.cs
- Visual3D.cs
- ClientScriptItemCollection.cs
- RuleSettingsCollection.cs
- Speller.cs
- RuleElement.cs
- OdbcConnectionPoolProviderInfo.cs
- CodeSubDirectory.cs
- SourceChangedEventArgs.cs
- AssertFilter.cs
- Paragraph.cs
- DesignerSerializationVisibilityAttribute.cs
- ConditionedDesigner.cs
- MultiPageTextView.cs
- HTMLTextWriter.cs
- HashMembershipCondition.cs
- DirectionalLight.cs
- Debug.cs
- ThreadSafeMessageFilterTable.cs
- ListItemCollection.cs
- SyndicationDeserializer.cs
- EmptyStringExpandableObjectConverter.cs
- XmlParserContext.cs
- XPathQilFactory.cs
- MemoryMappedFileSecurity.cs
- ProfileSettingsCollection.cs
- RowUpdatingEventArgs.cs
- CryptoHandle.cs
- EncryptedReference.cs
- ISFTagAndGuidCache.cs
- HwndKeyboardInputProvider.cs
- X509CertificateTrustedIssuerElementCollection.cs
- MessageSmuggler.cs
- CompoundFileIOPermission.cs
- WCFServiceClientProxyGenerator.cs
- CancellableEnumerable.cs
- OdbcParameterCollection.cs
- CodeCommentStatementCollection.cs
- Int32.cs
- ColorContext.cs
- TimeZone.cs
- CollectionViewProxy.cs
- WindowsTab.cs
- PropertyValueChangedEvent.cs
- CategoryList.cs
- SubstitutionList.cs
- PenCursorManager.cs
- BCryptNative.cs
- ControlEvent.cs
- behaviorssection.cs
- LinkedResourceCollection.cs
- EventArgs.cs
- UDPClient.cs
- followingsibling.cs
- RectangleHotSpot.cs
- HtmlHead.cs
- ErrorFormatterPage.cs
- DataPagerCommandEventArgs.cs
- TreeNodeStyleCollection.cs
- DataBindingExpressionBuilder.cs
- OpenFileDialog.cs
- PointLight.cs
- VariantWrapper.cs