/// <summary>
        /// Log the "can create" check.
        /// </summary>
        /// <param name="results">
        /// The result of the check, mapping each entity type ID to whether creation is allowed (true) or not (false). This cannot be null.
        /// </param>
        /// <param name="permission">
        /// The user requesting access. This cannot be null.
        /// </param>
        /// <param name="user">
        /// The user requesting access. This cannot be null.
        /// </param>
        /// <param name="entityTypes">
        /// The entity types being checked. This cannot be null.
        /// </param>
        /// <param name="duration">
        /// The total time taken for the check in milliseconds.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// No argument can be null.
        /// </exception>
        public void TraceCheckTypeAccess(IDictionary <long, bool> results, EntityRef permission, EntityRef user, IList <EntityRef> entityTypes, long duration)
        {
            if (results == null)
            {
                throw new ArgumentNullException("results");
            }
            if (entityTypes == null)
            {
                throw new ArgumentNullException("entityTypes");
            }
            if (entityTypes.Contains(null))
            {
                throw new ArgumentNullException("entityTypes", "Cannot contain null");
            }
            if (permission == null)
            {
                throw new ArgumentNullException("permission");
            }
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            PlatformTrace.Instance.TraceSecurityCheckType(
                string.Join(",", results.Select(x => + x.Key + ":" + x.Value)),
                string.Join(",", entityTypes.Select(x => x.ToString())),
                permission.ToString(),
                user.ToString(),
                duration);
        }
Пример #2
0
        /// <summary>
        /// Finds the named relationships.
        /// </summary>
        public static IEnumerable <RelationshipRequest> FindRelationshipRequests(this EntityMemberRequest request, EntityRef findRelationshipType)
        {
            var relRequests = Delegates.WalkGraph(request.Relationships, rel => rel.RequestedMembers.Relationships);

            string sFind = findRelationshipType.ToString();

            return(relRequests.Where(r => r.RelationshipTypeId.ToString() == sFind));
        }
Пример #3
0
		private static WorkQueueItem Create(
			string accessionNumber,
			EntityRef reportRef,
			EntityRef practitionerRef,
			EntityRef contactPointRef)
		{
			var workQueueItem = new WorkQueueItem("Mail/Fax Report");
			workQueueItem.ExtendedProperties.Add("AccessionNumber", accessionNumber);
			workQueueItem.ExtendedProperties.Add("ReportOID", reportRef.ToString(false, false));
			workQueueItem.ExtendedProperties.Add("ExternalPractitionerOID", practitionerRef.ToString(false, false));
			workQueueItem.ExtendedProperties.Add("ExternalPractitionerContactPointOID", contactPointRef.ToString(false, false));

			return workQueueItem;
		}
Пример #4
0
        private static WorkQueueItem Create(
            string accessionNumber,
            EntityRef reportRef,
            EntityRef practitionerRef,
            EntityRef contactPointRef)
        {
            var workQueueItem = new WorkQueueItem("Mail/Fax Report");

            workQueueItem.ExtendedProperties.Add("AccessionNumber", accessionNumber);
            workQueueItem.ExtendedProperties.Add("ReportOID", reportRef.ToString(false, false));
            workQueueItem.ExtendedProperties.Add("ExternalPractitionerOID", practitionerRef.ToString(false, false));
            workQueueItem.ExtendedProperties.Add("ExternalPractitionerContactPointOID", contactPointRef.ToString(false, false));

            return(workQueueItem);
        }
Пример #5
0
        /// <summary>
        /// Finds the relationship request by type name.
        /// </summary>
        public static RelationshipRequest FindRel(this EntityMemberRequest request, EntityRef findRelationshipType)
        {
            if (findRelationshipType == null)
            {
                return(null);
            }
            if (request == null)
            {
                return(null);
            }
            if (request.Relationships == null)
            {
                return(null);
            }

            string sFind = findRelationshipType.ToString();

            return(request.Relationships.FirstOrDefault(r => r.RelationshipTypeId.ToString() == sFind));
        }
        /// <summary>
        /// Log the access control check.
        /// </summary>
        /// <param name="results">
        /// The result of the check, mapping each entity ID to whether access is allowed (true) or not (false). This cannot be null.
        /// </param>
        /// <param name="permissions">
        /// The permissions or operations checked. This cannot be null or contain null.
        /// </param>
        /// <param name="user">
        /// The user requesting access. This cannot be null.
        /// </param>
        /// <param name="cacheResult">
        /// If the entity is present, the check was answered by cache and the value is access was granted (true) or not (false). This may be null.
        /// </param>
        /// <param name="duration">
        /// The total time taken for the check in milliseconds.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// No argument can be null.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="permissions"/> can contain null.
        /// </exception>
        public void TraceCheckAccess(IDictionary <long, bool> results, IList <EntityRef> permissions, EntityRef user, IDictionary <long, bool> cacheResult, long duration)
        {
            if (results == null)
            {
                throw new ArgumentNullException("results");
            }
            if (permissions == null)
            {
                throw new ArgumentNullException("permissions");
            }
            if (permissions.Any(x => x == null))
            {
                throw new ArgumentException("Cannot contain null entries", "permissions");
            }
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            string cacheResultText;

            if (cacheResult != null)
            {
                cacheResultText = String.Join(",", cacheResult.Select(x => + x.Key + ":" + x.Value));
            }
            else
            {
                cacheResultText = string.Empty;
            }

            PlatformTrace.Instance.TraceSecurityCheck(
                String.Join(",", results.Select(x => + x.Key + ":" + x.Value)),
                String.Join(",", permissions.Select(x => x.ToString())),
                user.ToString(),
                cacheResultText, duration);
        }
Пример #7
0
 private static string GenerateDocumentKey(Type documentType, EntityRef subject)
 {
     return(subject == null
                         ? string.Format("{0}", documentType)
                         : string.Format("{0}+{1}", documentType, subject.ToString(false)));
 }
 private static string MakeKey(EntityRef entityRef)
 {
     // use a cache key that is independent of entity-ref version
     return(entityRef.ToString(false, true));
 }
Пример #9
0
        /// <summary>
        /// Pre-load just the query portion of a report.
        /// </summary>
        /// <param name="reportId">The ID of the report to preload.</param>
        public static void PreloadQuery(EntityRef reportId)
        {
            var rq = new EntityRequest(reportId, QueryPreloaderQuery, "Preload query " + reportId.ToString( ));

            BulkPreloader.Preload(rq);
        }
Пример #10
0
        /// <summary>
        /// Pre-load report entities.
        /// </summary>
        /// <param name="reportId">The ID of the report to preload.</param>
        public static void PreloadReport(EntityRef reportId)
        {
            using (MessageContext messageContext = new MessageContext("Reports"))
            {
                messageContext.Append(() => string.Format("Preload report {0}", reportId));

                var rq = new EntityRequest(reportId, ReportPreloaderQuery, "Preload report " + reportId.ToString( ));
                BulkPreloader.Preload(rq);
            }
        }