Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- AmbientProperties.cs
- HttpCapabilitiesEvaluator.cs
- TextServicesPropertyRanges.cs
- TextView.cs
- SQLDecimal.cs
- DataGridViewBindingCompleteEventArgs.cs
- DataGridTextBoxColumn.cs
- XmlILAnnotation.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- XmlSchemaObject.cs
- XmlSchemaException.cs
- TemplateBindingExpression.cs
- ViewGenResults.cs
- ContentType.cs
- PageParser.cs
- smtppermission.cs
- NameValueFileSectionHandler.cs
- ProtectedConfigurationProviderCollection.cs
- WCFBuildProvider.cs
- ServiceMetadataPublishingElement.cs
- Mappings.cs
- RelationshipConstraintValidator.cs
- NetStream.cs
- CSharpCodeProvider.cs
- StorageComplexTypeMapping.cs
- CodeTypeReferenceExpression.cs
- MenuItemStyle.cs
- RelationshipWrapper.cs
- FastPropertyAccessor.cs
- MembershipSection.cs
- SmiContextFactory.cs
- DataGridItem.cs
- Matrix3D.cs
- ComponentSerializationService.cs
- MeasurementDCInfo.cs
- PathNode.cs
- BitmapEffectState.cs
- DrawingContextDrawingContextWalker.cs
- DataTemplate.cs
- DataServiceResponse.cs
- RoutedUICommand.cs
- ColorTransformHelper.cs
- Converter.cs
- InvalidTimeZoneException.cs
- CatalogPartChrome.cs
- WebScriptServiceHostFactory.cs
- XDRSchema.cs
- TemplateInstanceAttribute.cs
- LogRecordSequence.cs
- Ppl.cs
- StatusBarPanelClickEvent.cs
- CallbackTimeoutsBehavior.cs
- ExtendedPropertyDescriptor.cs
- ExpressionWriter.cs
- EventProviderClassic.cs
- SelectorItemAutomationPeer.cs
- PocoEntityKeyStrategy.cs
- XmlDocument.cs
- TimelineGroup.cs
- SecurityCookieModeValidator.cs
- CellQuery.cs
- AuthenticationConfig.cs
- TreeView.cs
- ContentElement.cs
- Util.cs
- OpCopier.cs
- TransactionChannelFactory.cs
- TransformerInfoCollection.cs
- ResXResourceWriter.cs
- EmbeddedMailObjectCollectionEditor.cs
- ResourceBinder.cs
- SHA384Managed.cs
- Switch.cs
- UserNameSecurityTokenAuthenticator.cs
- PageVisual.cs
- WindowsMenu.cs
- ModuleConfigurationInfo.cs
- FtpCachePolicyElement.cs
- DataObjectMethodAttribute.cs
- DataGridViewImageColumn.cs
- LineProperties.cs
- ResourceDescriptionAttribute.cs
- FlagsAttribute.cs
- _FixedSizeReader.cs
- MaskDescriptor.cs
- Byte.cs
- NavigationFailedEventArgs.cs
- PropertyEntry.cs
- ProfileSection.cs
- OutputCacheModule.cs
- Delegate.cs
- DataControlFieldHeaderCell.cs
- ToolboxItem.cs
- PixelShader.cs
- SendAgentStatusRequest.cs
- GeometryCollection.cs
- ZipPackage.cs
- EncodingTable.cs
- SQLInt64Storage.cs
- X509Extension.cs