Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / System / Security / RightsManagement / Grant.cs / 1305600 / Grant.cs
//------------------------------------------------------------------------------ // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: This class represents a (ContentUser , ContentRight) pair. // // History: // 06/01/2005: IgorBel : Initial Implementation // //----------------------------------------------------------------------------- using System; using System.Collections; using System.Diagnostics; using System.Globalization; using System.Windows; using MS.Internal.Security.RightsManagement; using SecurityHelper=MS.Internal.WindowsBase.SecurityHelper; namespace System.Security.RightsManagement { ////// ContentGrant class represent a (ContentUser , ContentRight) pair this is /// a basic building block for structures that need to express information about rights granted to a document. /// ////// Critical: This class expose access to methods that eventually do one or more of the the following /// 1. call into unmanaged code /// 2. affects state/data that will eventually cross over unmanaged code boundary /// 3. Return some RM related information which is considered private /// /// TreatAsSafe: This attribute automatically applied to all public entry points. All the public entry points have /// Demands for RightsManagementPermission at entry to counter the possible attacks that do /// not lead to the unmanaged code directly(which is protected by another Demand there) but rather leave /// some status/data behind which eventually might cross the unamanaged boundary. /// [SecurityCritical(SecurityCriticalScope.Everything)] public class ContentGrant { ////// Constructor for the read only ContentGrant class. It takes values for user and right as parameters. /// public ContentGrant(ContentUser user, ContentRight right) : this(user, right, DateTime.MinValue, DateTime.MaxValue) { } ////// Constructor for the read only ContentGrant class. It takes values for /// user, right, validFrom, and validUntil as parameters. /// public ContentGrant(ContentUser user, ContentRight right, DateTime validFrom, DateTime validUntil) { SecurityHelper.DemandRightsManagementPermission(); // Add validation here if (user == null) { throw new ArgumentNullException("user"); } if ((right != ContentRight.View) && (right != ContentRight.Edit) && (right != ContentRight.Print) && (right != ContentRight.Extract) && (right != ContentRight.ObjectModel) && (right != ContentRight.Owner) && (right != ContentRight.ViewRightsData) && (right != ContentRight.Forward) && (right != ContentRight.Reply) && (right != ContentRight.ReplyAll) && (right != ContentRight.Sign) && (right != ContentRight.DocumentEdit) && (right != ContentRight.Export)) { throw new ArgumentOutOfRangeException("right"); } if (validFrom > validUntil) { throw new ArgumentOutOfRangeException("validFrom"); } _user = user; _right = right; _validFrom = validFrom; _validUntil = validUntil; } ////// Read only User propery. /// public ContentUser User { get { SecurityHelper.DemandRightsManagementPermission(); return _user; } } ////// Read only Right propery. /// public ContentRight Right { get { SecurityHelper.DemandRightsManagementPermission(); return _right; } } ////// The starting validity time, in UTC time, for the grant. /// public DateTime ValidFrom { get { SecurityHelper.DemandRightsManagementPermission(); return _validFrom; } } ////// The ending validity time, in UTC time, for the grant. /// public DateTime ValidUntil { get { SecurityHelper.DemandRightsManagementPermission(); return _validUntil; } } private ContentUser _user; private ContentRight _right; private DateTime _validFrom; private DateTime _validUntil; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ObjRef.cs
- SecUtil.cs
- EncoderFallback.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- SubpageParagraph.cs
- TemplatePartAttribute.cs
- XmlRootAttribute.cs
- GradientStopCollection.cs
- DocumentApplication.cs
- ReplyChannel.cs
- ReliableRequestSessionChannel.cs
- TableRow.cs
- SwitchExpression.cs
- ProtocolsSection.cs
- _Connection.cs
- PictureBox.cs
- TimeSpanStorage.cs
- UnSafeCharBuffer.cs
- ToolStripComboBox.cs
- Int32Animation.cs
- RC2CryptoServiceProvider.cs
- ApplicationFileParser.cs
- PermissionSetTriple.cs
- ResourceAssociationType.cs
- TypeBrowser.xaml.cs
- DataGridRow.cs
- TargetException.cs
- SystemWebSectionGroup.cs
- HasRunnableWorkflowEvent.cs
- HtmlTitle.cs
- ListViewItem.cs
- TransactionFilter.cs
- X509AudioLogo.cs
- DynamicValidatorEventArgs.cs
- Model3D.cs
- MeshGeometry3D.cs
- IgnoreFileBuildProvider.cs
- CleanUpVirtualizedItemEventArgs.cs
- ItemCheckEvent.cs
- XmlSchemaSequence.cs
- ColorTranslator.cs
- Control.cs
- OpenTypeLayoutCache.cs
- TaskScheduler.cs
- ExtenderHelpers.cs
- DBDataPermissionAttribute.cs
- KoreanLunisolarCalendar.cs
- SQLInt64.cs
- CfgParser.cs
- WebServiceFault.cs
- PeekCompletedEventArgs.cs
- InvalidAsynchronousStateException.cs
- EdmPropertyAttribute.cs
- BmpBitmapDecoder.cs
- DashStyles.cs
- OleDbDataReader.cs
- SchemaComplexType.cs
- ProcessThreadDesigner.cs
- WebPartMinimizeVerb.cs
- ValidationSummary.cs
- PersistChildrenAttribute.cs
- DbParameterCollectionHelper.cs
- Panel.cs
- HitTestParameters3D.cs
- TypeUsage.cs
- TemplatedEditableDesignerRegion.cs
- HttpException.cs
- DateTimeHelper.cs
- SourceFilter.cs
- IndentedTextWriter.cs
- RegexCharClass.cs
- EdmItemError.cs
- AuthenticodeSignatureInformation.cs
- QueryStringParameter.cs
- SQLInt16.cs
- RowUpdatedEventArgs.cs
- coordinatorfactory.cs
- SvcMapFileLoader.cs
- TrackingProfileDeserializationException.cs
- ProviderException.cs
- cookie.cs
- XmlSerializerNamespaces.cs
- GradientBrush.cs
- XmlValidatingReaderImpl.cs
- DesignerOptionService.cs
- PartManifestEntry.cs
- FileDialog.cs
- SizeAnimation.cs
- BuildManagerHost.cs
- Privilege.cs
- DataException.cs
- ISAPIRuntime.cs
- CopyCodeAction.cs
- Empty.cs
- PropertyStore.cs
- HttpPostLocalhostServerProtocol.cs
- TableProviderWrapper.cs
- ProtocolsConfigurationEntry.cs
- DataSourceSelectArguments.cs
- SessionStateItemCollection.cs