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
- DictionarySurrogate.cs
- TemplateContent.cs
- EmulateRecognizeCompletedEventArgs.cs
- WSHttpTransportSecurityElement.cs
- OracleTransaction.cs
- Int32Storage.cs
- COMException.cs
- DataGridRowEventArgs.cs
- HelpProvider.cs
- DocumentApplication.cs
- StylusPointPropertyInfo.cs
- InvalidEnumArgumentException.cs
- DragStartedEventArgs.cs
- TreeNodeEventArgs.cs
- DataMemberFieldEditor.cs
- PowerModeChangedEventArgs.cs
- SqlInfoMessageEvent.cs
- File.cs
- SerialReceived.cs
- CodeMemberMethod.cs
- XslAstAnalyzer.cs
- TextRangeEditLists.cs
- LineGeometry.cs
- VectorCollectionConverter.cs
- ObjectDataSource.cs
- StringPropertyBuilder.cs
- CatalogZoneBase.cs
- CompilerGeneratedAttribute.cs
- _emptywebproxy.cs
- DecoderFallback.cs
- ContextStack.cs
- ColumnMapCopier.cs
- StructuralObject.cs
- TreeViewAutomationPeer.cs
- ExpandableObjectConverter.cs
- ButtonRenderer.cs
- Logging.cs
- ApplicationActivator.cs
- IPCCacheManager.cs
- AutomationPeer.cs
- NTAccount.cs
- NamedPermissionSet.cs
- CultureInfoConverter.cs
- Control.cs
- ToolStripPanelSelectionGlyph.cs
- EntityDataSourceView.cs
- ListViewEditEventArgs.cs
- ElementInit.cs
- ViewCellSlot.cs
- ServiceOperationInvoker.cs
- SessionSwitchEventArgs.cs
- Shape.cs
- DeflateStream.cs
- RelOps.cs
- ShapeTypeface.cs
- ResourceLoader.cs
- SplineKeyFrames.cs
- ObjectMaterializedEventArgs.cs
- GeneralEndpointIdentity.cs
- EventNotify.cs
- EncryptedReference.cs
- WebScriptServiceHostFactory.cs
- WpfWebRequestHelper.cs
- ArraySubsetEnumerator.cs
- SqlDataReaderSmi.cs
- ConsumerConnectionPointCollection.cs
- ColorBlend.cs
- URLString.cs
- DbParameterCollection.cs
- ColorConverter.cs
- CacheDependency.cs
- NamedPipeProcessProtocolHandler.cs
- QuaternionRotation3D.cs
- NativeWrapper.cs
- CodeStatement.cs
- HighContrastHelper.cs
- HttpServerVarsCollection.cs
- EngineSiteSapi.cs
- MulticastDelegate.cs
- BitmapEffectCollection.cs
- CompilerInfo.cs
- CounterSetInstanceCounterDataSet.cs
- CultureInfo.cs
- PropertyEmitterBase.cs
- PageParser.cs
- ApplicationSecurityInfo.cs
- XLinq.cs
- SAPICategories.cs
- SafeRightsManagementPubHandle.cs
- AppDomainAttributes.cs
- ComplexPropertyEntry.cs
- WebBrowserContainer.cs
- SecurityTokenParameters.cs
- DotExpr.cs
- DataServiceQueryContinuation.cs
- GAC.cs
- InternalUserCancelledException.cs
- Panel.cs
- HtmlTernaryTree.cs
- Vector.cs