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
- MetadataReference.cs
- RegisteredScript.cs
- TextParagraphView.cs
- Merger.cs
- TypefaceCollection.cs
- ComboBoxRenderer.cs
- SHA1CryptoServiceProvider.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- ArgumentOutOfRangeException.cs
- NamespaceQuery.cs
- FontConverter.cs
- BaseTemplateBuildProvider.cs
- SurrogateEncoder.cs
- ComponentRenameEvent.cs
- ConfigXmlAttribute.cs
- _FtpDataStream.cs
- ContentType.cs
- LicFileLicenseProvider.cs
- StatusBarPanelClickEvent.cs
- DateTimeSerializationSection.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- ConfigurationProperty.cs
- BindingValueChangedEventArgs.cs
- CollectionChangedEventManager.cs
- VariableReference.cs
- XPathArrayIterator.cs
- ComponentEditorPage.cs
- FixedNode.cs
- SqlBulkCopyColumnMappingCollection.cs
- ImageCodecInfoPrivate.cs
- TableLayout.cs
- DecoderFallbackWithFailureFlag.cs
- MemoryResponseElement.cs
- ScopedKnownTypes.cs
- Literal.cs
- GridViewPageEventArgs.cs
- SmtpSection.cs
- SiteOfOriginContainer.cs
- ISAPIWorkerRequest.cs
- BuildProviderUtils.cs
- TemplateApplicationHelper.cs
- DirectoryRedirect.cs
- TemplateManager.cs
- DbModificationCommandTree.cs
- _UriTypeConverter.cs
- CodeCastExpression.cs
- ToolStripPanelCell.cs
- XmlSerializationWriter.cs
- SQLByte.cs
- ObjectDataSourceView.cs
- DataView.cs
- TaskCanceledException.cs
- HTMLTagNameToTypeMapper.cs
- PerformanceCountersElement.cs
- DataGridViewAccessibleObject.cs
- BaseTemplateCodeDomTreeGenerator.cs
- SQLMoney.cs
- MessageContractExporter.cs
- EventSinkHelperWriter.cs
- HelpEvent.cs
- GenericWebPart.cs
- SingleStorage.cs
- Animatable.cs
- WebConfigurationManager.cs
- DelegateHelpers.cs
- UpdateProgress.cs
- JsonObjectDataContract.cs
- clipboard.cs
- DBBindings.cs
- TabItem.cs
- XmlnsCache.cs
- DrawingServices.cs
- MaskedTextProvider.cs
- WSTrust.cs
- IntSecurity.cs
- XmlCompatibilityReader.cs
- ButtonRenderer.cs
- BasicCellRelation.cs
- SetState.cs
- ValidationEventArgs.cs
- XmlWhitespace.cs
- OleDbEnumerator.cs
- ScrollProviderWrapper.cs
- EntityContainer.cs
- SystemSounds.cs
- TextCompositionManager.cs
- mactripleDES.cs
- WsatStrings.cs
- SecurityManager.cs
- NativeObjectSecurity.cs
- ExtensionSimplifierMarkupObject.cs
- SortedDictionary.cs
- CompModSwitches.cs
- XmlSerializerNamespaces.cs
- DataServiceBuildProvider.cs
- HtmlValidatorAdapter.cs
- AssemblyName.cs
- RepeaterItemEventArgs.cs
- RegexWorker.cs
- MouseWheelEventArgs.cs