Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / security / system / security / permissions / storepermissionattribute.cs / 1 / 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
- WmiEventSink.cs
- DocumentPaginator.cs
- HitTestParameters.cs
- SecurityHeaderLayout.cs
- DataControlFieldHeaderCell.cs
- CodePropertyReferenceExpression.cs
- DrawingContextWalker.cs
- WmfPlaceableFileHeader.cs
- ClonableStack.cs
- LinqToSqlWrapper.cs
- QueuePathEditor.cs
- SocketElement.cs
- CSharpCodeProvider.cs
- WebPartsPersonalizationAuthorization.cs
- DoubleLink.cs
- TextBlockAutomationPeer.cs
- SecurityHeaderElementInferenceEngine.cs
- Emitter.cs
- ControlIdConverter.cs
- itemelement.cs
- NativeMethods.cs
- JumpTask.cs
- BrowserInteropHelper.cs
- StateInitializationDesigner.cs
- MessagePropertyAttribute.cs
- ObjectQuery_EntitySqlExtensions.cs
- EntityDataSourceContainerNameItem.cs
- Formatter.cs
- LicenseProviderAttribute.cs
- Enlistment.cs
- Model3DCollection.cs
- EnumUnknown.cs
- OleAutBinder.cs
- ConnectionPoolManager.cs
- InfoCardProofToken.cs
- XmlC14NWriter.cs
- StatusBar.cs
- DrawingBrush.cs
- ElementAction.cs
- Collection.cs
- X509CertificateStore.cs
- TypeDependencyAttribute.cs
- RowParagraph.cs
- BypassElement.cs
- DateTimeFormatInfoScanner.cs
- RangeValuePattern.cs
- DrawingState.cs
- ReachPrintTicketSerializer.cs
- ConnectionPoolManager.cs
- ClientTargetCollection.cs
- TreeViewImageKeyConverter.cs
- ThumbAutomationPeer.cs
- VirtualDirectoryMappingCollection.cs
- XmlAnyElementAttributes.cs
- AsyncCompletedEventArgs.cs
- AppDomainManager.cs
- ProviderUtil.cs
- NavigationEventArgs.cs
- RoleManagerEventArgs.cs
- EntityCommandExecutionException.cs
- Visitors.cs
- ScriptResourceHandler.cs
- TextEditorParagraphs.cs
- KnownTypesHelper.cs
- ImageBrush.cs
- WindowsListViewItem.cs
- DbProviderFactories.cs
- ObjectListCommandsPage.cs
- CodeAttributeDeclaration.cs
- SQLBytesStorage.cs
- parserscommon.cs
- ImageAutomationPeer.cs
- AnimationStorage.cs
- LocalizableAttribute.cs
- xml.cs
- DropDownList.cs
- OdbcCommandBuilder.cs
- DesignerAttribute.cs
- SingleKeyFrameCollection.cs
- GeneratedContractType.cs
- MdbDataFileEditor.cs
- UmAlQuraCalendar.cs
- CharEntityEncoderFallback.cs
- WebPermission.cs
- BrowserDefinition.cs
- SoapException.cs
- CharacterMetricsDictionary.cs
- HttpCookie.cs
- ConvertersCollection.cs
- TextViewDesigner.cs
- ExpressionWriter.cs
- SemanticResolver.cs
- RowVisual.cs
- KeyValueSerializer.cs
- LogicalTreeHelper.cs
- UserMapPath.cs
- Pair.cs
- FileLevelControlBuilderAttribute.cs
- XPathDocumentIterator.cs
- XmlRawWriter.cs