Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / TrustUi / MS / Internal / documents / RightsManagementLicense.cs / 1 / RightsManagementLicense.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: // RightsManagementLicense structs. // // History: // 06/13/05 - [....] created // //--------------------------------------------------------------------------- using System; using System.Collections; using System.IO.Packaging; using System.Security.RightsManagement; using System.Security; namespace MS.Internal.Documents { ////// RightsManagementLicense is a structure that describes the RM grants given to a /// user. The data in this class is critical for set, so only Critical code can /// modify the rights granted or the user to whom they are granted. /// internal sealed class RightsManagementLicense { #region Constructors (none) //----------------------------------------------------- // Constructors (none) //----------------------------------------------------- #endregion Constructors (none) #region Internal Methods //------------------------------------------------------ // Internal Methods //----------------------------------------------------- ////// Adds a permission to the list of permissions saved in the license. /// /// The permission to add. ////// Critical /// 1) This is modifying the permissions granted to the holder of this /// license. /// [SecurityCritical] internal void AddPermission(RightsManagementPermissions permission) { _userRights.Value |= permission; } ////// Checks whether the license grants the given permission. /// /// The permission to check for ///Whether or not the license grants the permission internal bool HasPermission(RightsManagementPermissions permission) { return (((_userRights.Value & permission) == permission) && IsLicenseValid); } ////// Converts the permissions granted to a DRX Policy class. /// ///The permissions granted, converted to a policy internal RightsManagementPolicy ConvertToPolicy() { return (RightsManagementPolicy)(_userRights.Value); } #endregion Internal Methods #region Internal Properties //------------------------------------------------------ // Internal Properties //------------------------------------------------------ ////// Checks the validity dates of the license to see if the license is valid. /// ///Whether or not the license is still valid. internal bool IsLicenseValid { get { bool valid = true; // Check both whether the "valid from" date is in the future or the // "valid until" date is in the past. In either case the license is not // valid, and we must return false. if ((ValidFrom.CompareTo(DateTime.UtcNow) > 0) || (ValidUntil.CompareTo(DateTime.UtcNow) < 0)) { valid = false; } return valid; } } ////// Gets or sets the date from when the license is valid, in the UTC /// time zone /// ////// Critical /// 1) The setter is critical because it is setting a /// SecurityCriticalDataForSet field. /// internal DateTime ValidFrom { get { return _validFrom.Value; } [SecurityCritical] set { _validFrom.Value = value; } } ////// Gets or sets the date until when the license is valid, in the UTC /// time zone /// ////// Critical /// 1) The setter is critical because it is setting a /// SecurityCriticalDataForSet field. /// internal DateTime ValidUntil { get { return _validUntil.Value; } [SecurityCritical] set { _validUntil.Value = value; } } ////// Gets or sets the user for whom this license applies /// ////// Critical /// 1) The setter is critical because it is setting a /// SecurityCriticalDataForSet field. /// internal RightsManagementUser LicensedUser { get { return _user.Value; } [SecurityCritical] set { _user.Value = value; } } ////// Gets or sets the permissions granted by this license /// ////// Critical /// 1) The setter is critical because it is setting a /// SecurityCriticalDataForSet field. /// internal RightsManagementPermissions LicensePermissions { get { return _userRights.Value; } [SecurityCritical] set { _userRights.Value = value; } } ////// Gets or sets the name of the person to contact for more rights than /// are currently granted to the user. /// ////// Critical /// 1) This is personally identifiable information. /// internal string ReferralInfoName { [SecurityCritical] get { return _referralInfoName; } [SecurityCritical] set { _referralInfoName = value; } } ////// Gets or sets a URI to contact for more rights than are currently /// granted to the user. /// ////// Critical /// 1) This is personally identifiable information. /// internal Uri ReferralInfoUri { [SecurityCritical] get { return _referralInfoUri; } [SecurityCritical] set { _referralInfoUri = value; } } #endregion Internal Properties #region Private Fields //----------------------------------------------------- // Private Fields //------------------------------------------------------ private SecurityCriticalDataForSet_validFrom; private SecurityCriticalDataForSet _validUntil; private SecurityCriticalDataForSet _user; private SecurityCriticalDataForSet _userRights; /// /// The name of the person to contact for more rights. /// ////// Critical - personally identifiable information /// [SecurityCritical] private string _referralInfoName; ////// The URI to contact for more rights. /// ////// Critical - personally identifiable information /// [SecurityCritical] private Uri _referralInfoUri; #endregion Private Fields } } // 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
- _TLSstream.cs
- IEnumerable.cs
- FeatureSupport.cs
- BooleanAnimationUsingKeyFrames.cs
- InternalsVisibleToAttribute.cs
- ProfilePropertyMetadata.cs
- sqlser.cs
- SqlPersistenceProviderFactory.cs
- safesecurityhelperavalon.cs
- SyndicationSerializer.cs
- CollectionEditor.cs
- Subset.cs
- ToolBarButton.cs
- DateTimeOffsetConverter.cs
- ProcessHostMapPath.cs
- BaseInfoTable.cs
- BamlMapTable.cs
- XomlSerializationHelpers.cs
- SweepDirectionValidation.cs
- CatalogZoneBase.cs
- GregorianCalendarHelper.cs
- TriState.cs
- InternalRelationshipCollection.cs
- IncrementalReadDecoders.cs
- FormsAuthenticationTicket.cs
- RtfToken.cs
- ReachDocumentPageSerializer.cs
- RequestDescription.cs
- ValueSerializerAttribute.cs
- VariantWrapper.cs
- ViewStateAttachedPropertyFeature.cs
- SessionStateModule.cs
- PropertyTabChangedEvent.cs
- DataException.cs
- TextBox.cs
- PersonalizationStateInfoCollection.cs
- VirtualPathProvider.cs
- HtmlElementEventArgs.cs
- EFAssociationProvider.cs
- AggregateException.cs
- VariableAction.cs
- XhtmlBasicValidatorAdapter.cs
- ExcCanonicalXml.cs
- SoapTypeAttribute.cs
- ProcessModuleCollection.cs
- Axis.cs
- nulltextnavigator.cs
- XmlSchemaInferenceException.cs
- LineGeometry.cs
- PageClientProxyGenerator.cs
- Executor.cs
- ByteAnimationBase.cs
- RealizedColumnsBlock.cs
- CodeDesigner.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- CompositeTypefaceMetrics.cs
- Attachment.cs
- Int32RectConverter.cs
- ApplicationProxyInternal.cs
- VirtualPathProvider.cs
- ClientFormsIdentity.cs
- InputBuffer.cs
- AppDomainShutdownMonitor.cs
- SqlUserDefinedTypeAttribute.cs
- Rules.cs
- CacheDict.cs
- SecurityHeaderTokenResolver.cs
- XmlFormatReaderGenerator.cs
- PropertyGeneratedEventArgs.cs
- PackageDigitalSignatureManager.cs
- StrokeDescriptor.cs
- InkCanvasAutomationPeer.cs
- Vector3dCollection.cs
- CheckPair.cs
- MessageBuffer.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- namescope.cs
- DiffuseMaterial.cs
- SymbolPair.cs
- SchemaSetCompiler.cs
- MimeImporter.cs
- IndexingContentUnit.cs
- FilteredXmlReader.cs
- StorageEntityTypeMapping.cs
- PersonalizableTypeEntry.cs
- WindowsGrip.cs
- OracleTransaction.cs
- ResumeStoryboard.cs
- UniformGrid.cs
- COM2AboutBoxPropertyDescriptor.cs
- WebPartDisplayMode.cs
- WebPartHeaderCloseVerb.cs
- EntityDataSourceDesignerHelper.cs
- WebSysDefaultValueAttribute.cs
- XPathNodePointer.cs
- ExpandCollapsePattern.cs
- XPathNodeIterator.cs
- ProfileSettings.cs
- SignHashRequest.cs
- WebControlParameterProxy.cs