Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- DataGridViewRowHeaderCell.cs
- UnsafeNetInfoNativeMethods.cs
- TimeSpanSecondsConverter.cs
- Point3DCollection.cs
- ParameterCollection.cs
- KeyValueConfigurationElement.cs
- RectangleHotSpot.cs
- ApplicationException.cs
- ShaderRenderModeValidation.cs
- RuleSettings.cs
- StickyNoteAnnotations.cs
- TextReader.cs
- TableRowCollection.cs
- Variant.cs
- ModelItemCollection.cs
- DataGridViewRowEventArgs.cs
- HtmlSelect.cs
- BasicHttpBinding.cs
- VisualBrush.cs
- UIElementIsland.cs
- SqlDataSourceCustomCommandPanel.cs
- DurationConverter.cs
- Pair.cs
- StrokeCollectionConverter.cs
- InterleavedZipPartStream.cs
- HtmlHistory.cs
- NumberSubstitution.cs
- xmlformatgeneratorstatics.cs
- BamlLocalizer.cs
- TemplatePartAttribute.cs
- AssociationEndMember.cs
- BaseTemplateBuildProvider.cs
- ZipIOExtraFieldZip64Element.cs
- PersonalizationDictionary.cs
- DataErrorValidationRule.cs
- EdmValidator.cs
- AuthorizationRule.cs
- XsltInput.cs
- CqlIdentifiers.cs
- Italic.cs
- UnsafeNativeMethods.cs
- Currency.cs
- connectionpool.cs
- IdentityNotMappedException.cs
- WebServiceAttribute.cs
- SystemIcmpV6Statistics.cs
- ResXResourceReader.cs
- DeferredSelectedIndexReference.cs
- RegexGroup.cs
- MetaModel.cs
- Guid.cs
- ApplyTemplatesAction.cs
- GroupBox.cs
- XmlBinaryReaderSession.cs
- SByte.cs
- PropertyManager.cs
- ADMembershipProvider.cs
- XmlDocumentType.cs
- smtpconnection.cs
- SafeHandles.cs
- EditorPartDesigner.cs
- WindowsHyperlink.cs
- HTTPNotFoundHandler.cs
- TypeSystem.cs
- PerformanceCounterPermissionEntry.cs
- RoutedEventConverter.cs
- CounterSampleCalculator.cs
- RenamedEventArgs.cs
- CodePropertyReferenceExpression.cs
- hebrewshape.cs
- RIPEMD160Managed.cs
- AncillaryOps.cs
- ReturnValue.cs
- cookiecollection.cs
- System.Data.OracleClient_BID.cs
- WSSecurityPolicy.cs
- BamlRecordReader.cs
- TextEndOfLine.cs
- TableLayoutColumnStyleCollection.cs
- InvalidProgramException.cs
- WrappedReader.cs
- CryptoApi.cs
- MappingItemCollection.cs
- XmlSchemaImport.cs
- CustomWebEventKey.cs
- TypographyProperties.cs
- OutputScope.cs
- DiscoveryExceptionDictionary.cs
- SwitchElementsCollection.cs
- ObjectSecurity.cs
- DataPagerFieldCollection.cs
- WindowsRichEdit.cs
- UnrecognizedPolicyAssertionElement.cs
- XmlComment.cs
- URLMembershipCondition.cs
- GlobalProxySelection.cs
- ZipIOExtraField.cs
- GeometryCollection.cs
- Rfc2898DeriveBytes.cs
- GridViewUpdateEventArgs.cs