Esempio n. 1
0
        void PostJobRoutine()
        {
            try
            {
                if (String.IsNullOrEmpty(Owner) || (null == PatientRightsDataAccess))
                {
                    return;
                }

                string PatientId = GetPatientId();

                #region LOG
                {
                    string message = @"MoveObjectsJob PostJobRoutine - Started";
                    Logger.Global.Log(string.Empty, string.Empty, -1, string.Empty, string.Empty, -1, DicomCommandType.Undefined, DateTime.Now,
                                      LogType.Information, MessageDirection.None, message, null, null);
                }
                #endregion
                PatientRightsDataAccess.GrantUserAccess(PatientId, Owner);
                #region LOG
                {
                    string message = @"MoveObjectsJob PostJobRoutine - Completed";
                    Logger.Global.Log(string.Empty, string.Empty, -1, string.Empty, string.Empty, -1, DicomCommandType.Undefined, DateTime.Now,
                                      LogType.Information, MessageDirection.None, message, null, null);
                }
                #endregion
            }
            catch
            {
                System.Diagnostics.Debug.Assert(false);

                //ignored
            }
        }
Esempio n. 2
0
        /// <summary>
        /// This is the main method that evaluates which patient a user/groups have access to then add them into the matching parameters
        /// </summary>
        /// <param name="matchingEntitiesCollection"></param>
        /// <param name="user"></param>
        /// <param name="groups"></param>
        /// <returns></returns>
        private bool FiltersAdded(MatchingParameterCollection matchingEntitiesCollection, string user, string[] groups)
        {
#if LEADTOOLS_V19_OR_LATER
            if (!EnablePatientRestriction)
            {
                return(true);
            }
#endif
            //if the user has the built-in Admin permission then it has access to all patients (this is legacy, usually there should be no permission called "Admin")
            if (PermissionManagementDataAccess.UserHasPermission("Admin", user) || InRole(user, "Administrators"))
            {
                return(true);
            }

            //query the patient IDS a user have access to
            List <string> patientIds = PatientRightsDataAccess.GetPatientIDs(user, groups);

            if (patientIds == null)
            {
                return(false);
            }

            if (patientIds.Count == 0)
            {
                //if user has no patients assigned then no access to anything
                return(false);
            }


            //add the patient IDs into the matching parameters, when the query runs these IDs will be combined with an OR
            foreach (MatchingParameterList matchingList in matchingEntitiesCollection)
            {
                Patient patient = new Patient( );

                //this join here for patient IDs produce the OR operator
                patient.PatientID = string.Join("\\", patientIds.ToArray( ));

                matchingList.Add(patient);
            }

            return(true);
        }