Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- Range.cs
- Random.cs
- ProcessManager.cs
- StringBlob.cs
- SoapAttributes.cs
- HitTestParameters3D.cs
- TreeNode.cs
- MediaContext.cs
- ItemsChangedEventArgs.cs
- UniqueEventHelper.cs
- DetailsViewModeEventArgs.cs
- ObjectMemberMapping.cs
- AsyncCodeActivityContext.cs
- XmlQuerySequence.cs
- TcpProcessProtocolHandler.cs
- OleDbWrapper.cs
- MultilineStringConverter.cs
- FormViewDeletedEventArgs.cs
- InfoCardKeyedHashAlgorithm.cs
- QueryRewriter.cs
- FixedDocumentPaginator.cs
- AllMembershipCondition.cs
- Validator.cs
- CommandBindingCollection.cs
- CookielessHelper.cs
- WebPartsPersonalization.cs
- XmlSchemaSimpleTypeUnion.cs
- CategoryAttribute.cs
- SeparatorAutomationPeer.cs
- OrderPreservingMergeHelper.cs
- TabControlCancelEvent.cs
- SqlPersonalizationProvider.cs
- OutKeywords.cs
- CollectionConverter.cs
- HierarchicalDataSourceControl.cs
- ToolStripGripRenderEventArgs.cs
- QueryContinueDragEventArgs.cs
- NetworkStream.cs
- DetailsViewUpdatedEventArgs.cs
- FontEditor.cs
- ProtocolReflector.cs
- SynchronizationContext.cs
- SqlDataSourceFilteringEventArgs.cs
- WSTrustDec2005.cs
- UiaCoreTypesApi.cs
- HttpDebugHandler.cs
- BaseTemplateCodeDomTreeGenerator.cs
- ItemCheckEvent.cs
- EffectiveValueEntry.cs
- Properties.cs
- ApplicationProxyInternal.cs
- CodeMethodReturnStatement.cs
- HttpClientCertificate.cs
- SvcMapFileLoader.cs
- LiteralControl.cs
- WebPartConnectionCollection.cs
- DateTimeUtil.cs
- CheckPair.cs
- Regex.cs
- TypeElementCollection.cs
- DataServiceQueryProvider.cs
- DataTableNewRowEvent.cs
- SessionStateModule.cs
- AlignmentYValidation.cs
- HyperLink.cs
- SQLBinary.cs
- Compress.cs
- ToolStripDropDown.cs
- SqlAliaser.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- ContainerSelectorActiveEvent.cs
- DateTimeFormat.cs
- JsonReaderWriterFactory.cs
- NativeWrapper.cs
- RegexCode.cs
- HttpGetClientProtocol.cs
- IconConverter.cs
- TransactionProtocolConverter.cs
- SqlDataSourceTableQuery.cs
- QueryOperationResponseOfT.cs
- ChannelBinding.cs
- XmlSchemaAttribute.cs
- TreeNode.cs
- EventPrivateKey.cs
- CurrencyManager.cs
- NullReferenceException.cs
- _ConnectionGroup.cs
- EventLogger.cs
- SizeAnimationBase.cs
- ParenthesizePropertyNameAttribute.cs
- DesignBinding.cs
- ColumnCollection.cs
- TemplateNodeContextMenu.cs
- ConfigXmlComment.cs
- SystemResourceKey.cs
- ResolveResponse.cs
- DelimitedListTraceListener.cs
- ImageAttributes.cs
- FastPropertyAccessor.cs
- ImageList.cs