Example #1
0
        private static void AuditLog(Study study, List <UpdateItem> fields)
        {
            Platform.CheckForNullReference(study, "study");
            Platform.CheckForNullReference(fields, "fields");

            var helper =
                new DicomInstancesAccessedAuditHelper(ServerPlatform.AuditSource,
                                                      EventIdentificationContentsEventOutcomeIndicator.Success,
                                                      EventIdentificationContentsEventActionCode.U);

            helper.AddUser(new AuditPersonActiveParticipant(
                               SessionManager.Current.Credentials.UserName,
                               null,
                               SessionManager.Current.Credentials.DisplayName));

            var participant = new AuditStudyParticipantObject(study.StudyInstanceUid, study.AccessionNumber);

            string updateDescription = StringUtilities.Combine(
                fields, ";",
                item => String.Format("Tag=\"{0}\" Value=\"{1}\"", item.DicomTag.Name, item.Value)
                );

            participant.ParticipantObjectDetailString = updateDescription;
            helper.AddStudyParticipantObject(participant);
            ServerPlatform.LogAuditMessage(helper);
        }
        public static void RemoveAuthorityGroupAccess(string studyInstanceUid, string accessionNumber, IList <string> assignedGroups)
        {
            Platform.CheckForNullReference(studyInstanceUid, "studyInstanceUid");
            Platform.CheckForNullReference(assignedGroups, "assignedGroups");

            var helper =
                new DicomInstancesAccessedAuditHelper(ServerPlatform.AuditSource,
                                                      EventIdentificationContentsEventOutcomeIndicator.Success,
                                                      EventIdentificationContentsEventActionCode.U,
                                                      EventTypeCode.ObjectSecurityAttributesChanged);

            // TODO: 8/19/2011, Develop a way to get the DisplayName for the user here for the audit log message
            helper.AddUser(new AuditPersonActiveParticipant(
                               Thread.CurrentPrincipal.Identity.Name,
                               null,
                               null));


            var participant = new AuditStudyParticipantObject(studyInstanceUid, accessionNumber);

            string updateDescription = StringUtilities.Combine(
                assignedGroups, ";",
                item => String.Format("Removed Group Access=\"{0}\"", item)
                );

            participant.ParticipantObjectDetailString = updateDescription;
            helper.AddStudyParticipantObject(participant);

            ServerPlatform.LogAuditMessage(helper);
        }
Example #3
0
        private void GenerateAuditLog()
        {
            var audit = new DicomInstancesAccessedAuditHelper(ServerPlatform.AuditSource, EventIdentificationContentsEventOutcomeIndicator.Success, EventIdentificationContentsEventActionCode.R /* Read*/);

            audit.AddUser(new AuditPersonActiveParticipant(SessionManager.Current.Credentials.UserName, null, SessionManager.Current.Credentials.DisplayName));

            var participant = new AuditStudyParticipantObject(_study.StudyInstanceUid, _study.AccessionNumber);

            participant.ParticipantObjectDetailString = string.Format("Partition: {0}", string.IsNullOrEmpty(_study.ThePartition.Description) ? _study.ThePartition.AeTitle : _study.ThePartition.Description);
            audit.AddStudyParticipantObject(participant);

            ServerAuditHelper.LogAuditMessage(audit);
        }
Example #4
0
        public void QueryAuditTest()
        {
            AssociationParameters parms = new ClientAssociationParameters("CLIENT", "SERVER",
                                                                          new IPEndPoint(new IPAddress(new byte[] { 2, 2, 2, 2 }),
                                                                                         2));

            parms.LocalEndPoint = new IPEndPoint(new IPAddress(new byte[] { 1, 1, 1, 1 }),
                                                 1);

            QueryAuditHelper helper =
                new QueryAuditHelper(new DicomAuditSource("testApplication"), EventIdentificationTypeEventOutcomeIndicator.Success, parms);

            helper.AddOtherParticipant(new AuditPersonActiveParticipant("testUser", "test@test", "Test Name"));
            helper.AddPatientParticipantObject(new AuditPatientParticipantObject("id1234", "Test Patient"));

            AuditStudyParticipantObject study = new AuditStudyParticipantObject("1.2.3.4.5", "A1234", "1.2.3");

            study.AddSopClass("1.2.3", 5);
            helper.AddStudyParticipantObject(study);

            string output = helper.Serialize(true);

            Assert.IsNotEmpty(output);

            string failure;
            bool   result = helper.Verify(out failure);

            Assert.IsTrue(result, failure);

            helper = new QueryAuditHelper(new DicomAuditSource("testApplication2", "enterpriseId", AuditSourceTypeCodeEnum.EndUserInterface), EventIdentificationTypeEventOutcomeIndicator.Success, parms);
            helper.AddStudyParticipantObject(new AuditStudyParticipantObject("1.2.3.4.5"));

            output = helper.Serialize(true);

            Assert.IsNotEmpty(output);

            result = helper.Verify(out failure);

            Assert.IsTrue(result, failure);
        }
Example #5
0
        public void QueryAuditTest()
        {
        	AssociationParameters parms = new ClientAssociationParameters("CLIENT", "SERVER",
        	                                                         new IPEndPoint(new IPAddress(new byte[] {2, 2, 2, 2}),
        	                                                                       2));
			parms.LocalEndPoint = new IPEndPoint(new IPAddress(new byte[] {1, 1, 1, 1}),
        	                                                                       1);

        	QueryAuditHelper helper =
        		new QueryAuditHelper(new DicomAuditSource("testApplication"), EventIdentificationTypeEventOutcomeIndicator.Success, parms);

			helper.AddOtherParticipant(new AuditPersonActiveParticipant("testUser","test@test","Test Name"));
        	helper.AddPatientParticipantObject(new AuditPatientParticipantObject("id1234", "Test Patient"));

			AuditStudyParticipantObject study = new AuditStudyParticipantObject("1.2.3.4.5", "A1234", "1.2.3");
        	study.AddSopClass("1.2.3", 5);
			helper.AddStudyParticipantObject(study);

        	string output = helper.Serialize(true);

        	Assert.IsNotEmpty(output);

        	string failure;
        	bool result = helper.Verify(out failure);

        	Assert.IsTrue(result, failure);

			helper = new QueryAuditHelper(new DicomAuditSource("testApplication2","enterpriseId", AuditSourceTypeCodeEnum.EndUserInterface),EventIdentificationTypeEventOutcomeIndicator.Success, parms);
			helper.AddStudyParticipantObject(new AuditStudyParticipantObject("1.2.3.4.5"));

			output = helper.Serialize(true);

			Assert.IsNotEmpty(output);

			result = helper.Verify(out failure);

			Assert.IsTrue(result, failure);              
        }
Example #6
0
        public void QueryAuditTest()
        {
            DicomAttributeCollection query = new DicomAttributeCollection();

            query[DicomTags.QueryRetrieveLevel].SetStringValue("STUDY");
            query[DicomTags.StudyInstanceUid].SetNullValue();
            query[DicomTags.PatientId].SetNullValue();
            query[DicomTags.AccessionNumber].SetNullValue();
            query[DicomTags.PatientsName].SetStringValue("*W*");
            query[DicomTags.ReferringPhysiciansName].SetNullValue();
            query[DicomTags.StudyDate].SetNullValue();
            query[DicomTags.StudyTime].SetNullValue();
            query[DicomTags.StudyDescription].SetNullValue();
            query[DicomTags.PatientsBirthDate].SetNullValue();
            query[DicomTags.ModalitiesInStudy].SetNullValue();
            query[DicomTags.NumberOfStudyRelatedInstances].SetNullValue();
            query[DicomTags.InstanceAvailability].SetNullValue();

            AssociationParameters parms = new ClientAssociationParameters("CLIENT", "SERVER",
                                                                          new IPEndPoint(new IPAddress(new byte[] { 2, 2, 2, 2 }),
                                                                                         2));

            parms.LocalEndPoint = new IPEndPoint(new IPAddress(new byte[] { 1, 1, 1, 1 }),
                                                 1);

            QueryAuditHelper helper =
                new QueryAuditHelper(new DicomAuditSource("testApplication"),
                                     EventIdentificationContentsEventOutcomeIndicator.Success, parms,
                                     SopClass.StudyRootQueryRetrieveInformationModelFindUid, query);

            helper.AddOtherParticipant(new AuditPersonActiveParticipant("testUser", "test@test", "Test Name"));
            helper.AddPatientParticipantObject(new AuditPatientParticipantObject("id1234", "Test Patient"));

            AuditStudyParticipantObject study = new AuditStudyParticipantObject("1.2.3.4.5", "A1234", "1.2.3");

            study.AddSopClass("1.2.3", 5);
            helper.AddStudyParticipantObject(study);

            string output = helper.Serialize(true);

            Assert.IsNotEmpty(output);

            Exception exception;

            //Assert.Ignore("Skipping schema validation due to schema bug #9455");
            //if (!helper.Verify(out exception))
            //    throw exception;

            helper =
                new QueryAuditHelper(
                    new DicomAuditSource("testApplication2", "enterpriseId", AuditSourceTypeCodeEnum.EndUserInterface),
                    EventIdentificationContentsEventOutcomeIndicator.Success, parms,
                    SopClass.StudyRootQueryRetrieveInformationModelFindUid, query);
            helper.AddStudyParticipantObject(new AuditStudyParticipantObject("1.2.3.4.5"));

            output = helper.Serialize(true);

            Assert.IsNotEmpty(output);

            Assert.Ignore("Skipping schema validation due to schema bug #9455");
            if (!helper.Verify(out exception))
            {
                throw exception;
            }
        }
Example #7
0
        public void QueryAuditTest()
        {
			DicomAttributeCollection query = new DicomAttributeCollection();
    		query[DicomTags.QueryRetrieveLevel].SetStringValue("STUDY");
			query[DicomTags.StudyInstanceUid].SetNullValue();
			query[DicomTags.PatientId].SetNullValue();
			query[DicomTags.AccessionNumber].SetNullValue();
			query[DicomTags.PatientsName].SetStringValue("*W*");
			query[DicomTags.ReferringPhysiciansName].SetNullValue();
			query[DicomTags.StudyDate].SetNullValue();
			query[DicomTags.StudyTime].SetNullValue();
			query[DicomTags.StudyDescription].SetNullValue();
			query[DicomTags.PatientsBirthDate].SetNullValue();
			query[DicomTags.ModalitiesInStudy].SetNullValue();
			query[DicomTags.NumberOfStudyRelatedInstances].SetNullValue();
    		query[DicomTags.InstanceAvailability].SetNullValue();

        	AssociationParameters parms = new ClientAssociationParameters("CLIENT", "SERVER",
        	                                                         new IPEndPoint(new IPAddress(new byte[] {2, 2, 2, 2}),
        	                                                                       2));
			parms.LocalEndPoint = new IPEndPoint(new IPAddress(new byte[] {1, 1, 1, 1}),
        	                                                                       1);

    		QueryAuditHelper helper =
    			new QueryAuditHelper(new DicomAuditSource("testApplication"),
    			                     EventIdentificationContentsEventOutcomeIndicator.Success, parms,
    			                     SopClass.StudyRootQueryRetrieveInformationModelFindUid, query);

			helper.AddOtherParticipant(new AuditPersonActiveParticipant("testUser","test@test","Test Name"));
        	helper.AddPatientParticipantObject(new AuditPatientParticipantObject("id1234", "Test Patient"));

			AuditStudyParticipantObject study = new AuditStudyParticipantObject("1.2.3.4.5", "A1234", "1.2.3");
        	study.AddSopClass("1.2.3", 5);
			helper.AddStudyParticipantObject(study);

        	string output = helper.Serialize(true);

			Assert.IsNotEmpty(output);

			Exception exception;
			//Assert.Ignore("Skipping schema validation due to schema bug #9455");
			//if (!helper.Verify(out exception))
			//    throw exception;

    		helper =
    			new QueryAuditHelper(
    				new DicomAuditSource("testApplication2", "enterpriseId", AuditSourceTypeCodeEnum.EndUserInterface),
    				EventIdentificationContentsEventOutcomeIndicator.Success, parms,
    				SopClass.StudyRootQueryRetrieveInformationModelFindUid, query);
			helper.AddStudyParticipantObject(new AuditStudyParticipantObject("1.2.3.4.5"));

			output = helper.Serialize(true);

			Assert.IsNotEmpty(output);

			Assert.Ignore("Skipping schema validation due to schema bug #9455");
			if (!helper.Verify(out exception))
				throw exception;           
        }