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
- Base64WriteStateInfo.cs
- BamlLocalizationDictionary.cs
- FunctionImportMapping.cs
- HttpResponseHeader.cs
- XmlBuffer.cs
- BitVector32.cs
- SemanticAnalyzer.cs
- ObjRef.cs
- ToolBarTray.cs
- SessionStateSection.cs
- DesignerAdapterUtil.cs
- SingletonConnectionReader.cs
- ToolboxItemAttribute.cs
- EventlogProvider.cs
- RegexRunnerFactory.cs
- CompositeClientFormatter.cs
- StartUpEventArgs.cs
- TreeView.cs
- EditorAttributeInfo.cs
- ObjectAssociationEndMapping.cs
- basemetadatamappingvisitor.cs
- TableNameAttribute.cs
- ProviderConnectionPointCollection.cs
- UITypeEditor.cs
- ViewCellSlot.cs
- XPathBinder.cs
- Win32SafeHandles.cs
- ConsoleTraceListener.cs
- WebPartDisplayMode.cs
- WorkflowApplicationIdleEventArgs.cs
- Wow64ConfigurationLoader.cs
- TrustLevelCollection.cs
- XmlSchemaComplexContentRestriction.cs
- XmlILIndex.cs
- OleDbStruct.cs
- TraceInternal.cs
- BaseProcessor.cs
- EditableRegion.cs
- Utils.cs
- GridViewCancelEditEventArgs.cs
- XDRSchema.cs
- ProcessHostConfigUtils.cs
- XmlName.cs
- DataSourceProvider.cs
- PointConverter.cs
- TrackingProfileDeserializationException.cs
- validation.cs
- AsynchronousChannelMergeEnumerator.cs
- documentsequencetextcontainer.cs
- TypeConverters.cs
- Monitor.cs
- EntityEntry.cs
- TypeInfo.cs
- AllowedAudienceUriElement.cs
- StdRegProviderWrapper.cs
- HtmlToClrEventProxy.cs
- ObjectSpanRewriter.cs
- StandardToolWindows.cs
- SqlConnectionManager.cs
- WorkflowDefinitionContext.cs
- Authorization.cs
- TcpStreams.cs
- XmlNodeWriter.cs
- SqlDataSourceCommandEventArgs.cs
- X509ChainPolicy.cs
- WebServiceErrorEvent.cs
- DesignerOptionService.cs
- FusionWrap.cs
- Material.cs
- _DomainName.cs
- MergePropertyDescriptor.cs
- ResourceExpressionBuilder.cs
- DbCommandDefinition.cs
- NTAccount.cs
- XpsDigitalSignature.cs
- PropertyManager.cs
- LoadedOrUnloadedOperation.cs
- DotAtomReader.cs
- CapacityStreamGeometryContext.cs
- Substitution.cs
- DesignTimeTemplateParser.cs
- PictureBox.cs
- SystemException.cs
- ImageCreator.cs
- UserControlCodeDomTreeGenerator.cs
- PromptBuilder.cs
- ProviderMetadata.cs
- SecurityUtils.cs
- HandledEventArgs.cs
- ExtendedProtectionPolicy.cs
- XmlILAnnotation.cs
- DeadCharTextComposition.cs
- DynamicValidatorEventArgs.cs
- DispatcherHookEventArgs.cs
- ForwardPositionQuery.cs
- Int64AnimationBase.cs
- DiagnosticTrace.cs
- PeerContact.cs
- StateValidator.cs
- RuntimeConfigurationRecord.cs