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
- XmlAttributes.cs
- ExpressionContext.cs
- RegexCapture.cs
- SequentialUshortCollection.cs
- MetadataAssemblyHelper.cs
- DataGridLinkButton.cs
- TargetConverter.cs
- UriGenerator.cs
- SerializationSectionGroup.cs
- TextEndOfSegment.cs
- RemotingConfiguration.cs
- FamilyMap.cs
- FigureParagraph.cs
- ButtonFieldBase.cs
- PageThemeParser.cs
- KnownTypes.cs
- DataGridLengthConverter.cs
- UserPersonalizationStateInfo.cs
- PointUtil.cs
- CopyAttributesAction.cs
- XNodeNavigator.cs
- ApplicationId.cs
- MenuItemBinding.cs
- StreamGeometryContext.cs
- DataGridColumnCollection.cs
- StackBuilderSink.cs
- ItemType.cs
- ToolStripHighContrastRenderer.cs
- Int32Collection.cs
- HtmlTernaryTree.cs
- PropertyFilterAttribute.cs
- XmlSchemaImport.cs
- FixedFindEngine.cs
- OdbcDataReader.cs
- CharacterMetricsDictionary.cs
- Setter.cs
- Errors.cs
- EarlyBoundInfo.cs
- WebPartExportVerb.cs
- ColorConvertedBitmapExtension.cs
- _ConnectStream.cs
- FontStyle.cs
- PublisherIdentityPermission.cs
- TreeNodeBindingDepthConverter.cs
- TextDecoration.cs
- WebPartConnectionsConfigureVerb.cs
- BamlRecordHelper.cs
- ExpressionParser.cs
- SuppressMergeCheckAttribute.cs
- PagedDataSource.cs
- coordinatorfactory.cs
- Ipv6Element.cs
- HttpFileCollection.cs
- securitycriticaldata.cs
- CharAnimationUsingKeyFrames.cs
- StorageAssociationTypeMapping.cs
- CodeEventReferenceExpression.cs
- SourceChangedEventArgs.cs
- ProvidePropertyAttribute.cs
- UserControlParser.cs
- Executor.cs
- DataControlField.cs
- BrushConverter.cs
- BoolLiteral.cs
- ToolboxDataAttribute.cs
- HGlobalSafeHandle.cs
- ConnectionManagementElementCollection.cs
- GridViewColumnHeaderAutomationPeer.cs
- OrderByLifter.cs
- PatternMatcher.cs
- PermissionListSet.cs
- Parameter.cs
- ResourceAssociationTypeEnd.cs
- AttachmentService.cs
- NonSerializedAttribute.cs
- DataFormat.cs
- ManipulationDeltaEventArgs.cs
- LocalTransaction.cs
- ClientType.cs
- WinEventWrap.cs
- DetailsView.cs
- InputReportEventArgs.cs
- PrintPreviewGraphics.cs
- InstanceLockLostException.cs
- CompilerTypeWithParams.cs
- Interop.cs
- METAHEADER.cs
- TraceHelpers.cs
- IndexedEnumerable.cs
- AnnotationObservableCollection.cs
- BlobPersonalizationState.cs
- SessionParameter.cs
- DataSourceIDConverter.cs
- ImportStoreException.cs
- Matrix3DStack.cs
- storepermission.cs
- AdCreatedEventArgs.cs
- Utils.cs
- TypeListConverter.cs
- StrokeDescriptor.cs