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
- AutomationPropertyInfo.cs
- ItemsPresenter.cs
- MasterPageParser.cs
- GroupBoxAutomationPeer.cs
- NameScopePropertyAttribute.cs
- GlobalEventManager.cs
- UnsafeNativeMethods.cs
- XmlValueConverter.cs
- CheckBox.cs
- ReturnType.cs
- WindowsProgressbar.cs
- QueryException.cs
- ConnectionManagementElement.cs
- ProcessModuleCollection.cs
- EditorZoneBase.cs
- DataServiceQuery.cs
- Debug.cs
- ChildChangedEventArgs.cs
- DbRetry.cs
- TraceUtility.cs
- QueryableFilterUserControl.cs
- BamlLocalizableResourceKey.cs
- Triangle.cs
- HttpWebRequest.cs
- ExpressionBuilderCollection.cs
- CodeRegionDirective.cs
- UIElement3D.cs
- SqlReorderer.cs
- GlobalItem.cs
- assemblycache.cs
- TextProperties.cs
- Event.cs
- Converter.cs
- FunctionDefinition.cs
- UTF32Encoding.cs
- CreateUserWizardAutoFormat.cs
- FontClient.cs
- IntegerValidatorAttribute.cs
- RootBrowserWindowProxy.cs
- InstalledVoice.cs
- SemanticResultValue.cs
- EmptyEnumerator.cs
- NumberSubstitution.cs
- ControlLocalizer.cs
- MiniLockedBorderGlyph.cs
- WindowsUserNameSecurityTokenAuthenticator.cs
- GenericEnumerator.cs
- SiblingIterators.cs
- XmlMemberMapping.cs
- XmlSchemaChoice.cs
- SystemResources.cs
- SignerInfo.cs
- SendDesigner.xaml.cs
- XsdBuildProvider.cs
- ValueType.cs
- SqlUdtInfo.cs
- ReflectionUtil.cs
- IssuedTokensHeader.cs
- WindowsRichEdit.cs
- DetailsViewCommandEventArgs.cs
- BitFlagsGenerator.cs
- CodeDirectionExpression.cs
- Freezable.cs
- RegexNode.cs
- SchemaNotation.cs
- ValueUtilsSmi.cs
- Win32.cs
- HasCopySemanticsAttribute.cs
- WSDualHttpSecurityMode.cs
- X509CertificateValidator.cs
- WindowsScrollBar.cs
- Run.cs
- ExpandoClass.cs
- SoapAttributeAttribute.cs
- SharedPerformanceCounter.cs
- RoutedCommand.cs
- TextDecorationUnitValidation.cs
- TableColumn.cs
- SymmetricCryptoHandle.cs
- XsltLoader.cs
- StringWriter.cs
- DataControlPagerLinkButton.cs
- unsafenativemethodsother.cs
- LinkButton.cs
- VectorKeyFrameCollection.cs
- WebServiceHostFactory.cs
- Privilege.cs
- MexHttpBindingElement.cs
- WorkflowServiceAttributesTypeConverter.cs
- SplitterPanel.cs
- CompiledQueryCacheEntry.cs
- XmlHierarchicalDataSourceView.cs
- CallbackDebugBehavior.cs
- ServiceAuthorizationManager.cs
- SemanticValue.cs
- CachedPathData.cs
- AliasExpr.cs
- WindowsScroll.cs
- ToolStripStatusLabel.cs
- MessageProperties.cs