Exemplo n.º 1
0
 public AuthorizedStorageDataAccessAgent(IStorageDataAccessAgent3 storageDataAccess, IPatientRightsDataAccessAgent patientRightsDataAccess, IPermissionManagementDataAccessAgent permissionManagementDataAccessAgent)
 {
     StorageDataAccess               = storageDataAccess;
     PatientRightsDataAccess         = patientRightsDataAccess;
     PermissionManagementDataAccess  = permissionManagementDataAccessAgent;
     PermissionManagementDataAccess2 = permissionManagementDataAccessAgent as IPermissionManagementDataAccessAgent2;
 }
Exemplo n.º 2
0
        static void RegisterDataAccessAgents(string serviceName)
        {
            System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServiceDirectory);
            if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent> ( ))
            {
                IStorageDataAccessAgent storageDataAccess = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IStorageDataAccessAgent> ( );

                DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent> (storageDataAccess);

                DataAccess = storageDataAccess;
            }
            else
            {
                DataAccess = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IPermissionManagementDataAccessAgent> ( ))
            {
                try
                {
                    IPermissionManagementDataAccessAgent permissionsDataAccess = DataAccessFactory.GetInstance(new AePermissionManagementDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IPermissionManagementDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IPermissionManagementDataAccessAgent>(permissionsDataAccess);

                    PermissionsAgent = permissionsDataAccess;
                }
                catch (Exception)
                {
                }
            }
            else
            {
                PermissionsAgent = DataAccessServices.GetDataAccessService <IPermissionManagementDataAccessAgent>();
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IOptionsDataAccessAgent> ( ))
            {
                try
                {
                    IOptionsDataAccessAgent optionsDataAccess = DataAccessFactory.GetInstance(new OptionsDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IOptionsDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IOptionsDataAccessAgent>(optionsDataAccess);
                }
                catch (Exception)
                {
                }
            }

            //TODO: Check if workstastion data access is registered if not then check if config information
            //is available. create only if config options available otherwise don't.
            //the database manager will use the ws dataAccess only if registered.
            //if ( !DataAccessServices.IsDataAccessServiceRegistered <IWorkstationDataAccess> ( ) )
            //{
            //   IOptionsDataAccessAgent optionsDataAccess = DataAccessFactory.GetInstance ( new OptionsDataAccessConfigurationView (configuration, null, serviceName) ).CreateDataAccessAgent <IOptionsDataAccessAgent> ( ) ;

            //   DataAccessServices.RegisterDataAccessService <IOptionsDataAccessAgent> ( optionsDataAccess ) ;
            //}
        }
Exemplo n.º 3
0
        static UserManager()
        {
#if LEADTOOLS_V19_OR_LATER
            userAgent = GetDataAccess <IUserManagementDataAccessAgent4>(new UserManagementDataAccessConfigurationView2(GlobalPacsConfiguration, DicomDemoSettingsManager.ProductNameStorageServer, null));
#else
            userAgent = GetDataAccess <IUserManagementDataAccessAgent2>(new UserManagementDataAccessConfigurationView2(GlobalPacsConfiguration, DicomDemoSettingsManager.ProductNameStorageServer, null));
#endif
            permissionsAgent  = GetDataAccess <IPermissionManagementDataAccessAgent>(new PermissionManagementDataAccessConfigurationView(GlobalPacsConfiguration, DicomDemoSettingsManager.ProductNameStorageServer, null));
            optionsAgent      = GetDataAccess <IOptionsDataAccessAgent>(new OptionsDataAccessConfigurationView(GlobalPacsConfiguration, DicomDemoSettingsManager.ProductNameStorageServer, null));
            permissionsAgent2 = GetDataAccess <IPermissionManagementDataAccessAgent2>(new PermissionManagementDataAccessConfigurationView(GlobalPacsConfiguration, DicomDemoSettingsManager.ProductNameStorageServer, null));
        }
Exemplo n.º 4
0
        void _view_LoadClients(object sender, EventArgs e)
        {
            IAeManagementDataAccessAgent2 agent = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent>() as IAeManagementDataAccessAgent2;

            if (agent == null)
            {
                return;
            }

#if LEADTOOLS_V20_OR_LATER
            IOptionsDataAccessAgent optionsAgent = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>() as IOptionsDataAccessAgent;
            if (optionsAgent == null)
            {
                return;
            }

            AeInfoExtended searchParams = new AeInfoExtended();
#endif // #if LEADTOOLS_V20_OR_LATER

            AeInfoExtended[] aeInfoExtendedArray = agent.GetAeTitles();

            IPermissionManagementDataAccessAgent permissionsAgent = DataAccessServices.GetDataAccessService <IPermissionManagementDataAccessAgent>();

            // Get the list of all possible permissions
            _view.Permissions = permissionsAgent.GetPermissions();

            // The LEADTOOLS skinned version defaults to all permissions on
            if (Shell.storageServerName.Contains("LEAD"))
            {
                _view.NewClientPermissions = _view.Permissions; // All permissions on by default;
            }
            else
            {
                _view.NewClientPermissions = new Permission[0]; // All permissions off by default;
            }
            _view.ClientInformationList = new ClientInformationList();

            // view.ClientInformationList.AddItems(aeInfoExtendedArray);
            foreach (AeInfoExtended info in aeInfoExtendedArray)
            {
                string[]          permissionsArray = permissionsAgent.GetUserPermissions(info.AETitle);
                ClientInformation ci = new ClientInformation(info, permissionsArray);
                _view.ClientInformationList.ClientDictionary.Add(info.AETitle, ci);
            }

            // Make a backup of the settings
            ServerState.Instance.ClientList = new ClientInformationList(_view.ClientInformationList);
        }
Exemplo n.º 5
0
        private bool CheckPermissions()
        {
            try
            {
                System.Configuration.Configuration   configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory);
                IPermissionManagementDataAccessAgent agent         = DataAccessFactory.GetInstance(new AePermissionManagementDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IPermissionManagementDataAccessAgent>();
                string[] permissions = agent.GetUserPermissions(_Client.AETitle);

                return(permissions.Contains(UpdatePermission));
            }
            catch (Exception e)
            {
                Logger.Global.Exception("Patient Updater", e);
            }
            return(false);
        }
Exemplo n.º 6
0
        void UsersAccounts_EditUserPermissions(object sender, EditUserPermissionsEventArgs e)
        {
            PermissionsDialog permissionDialog         = new PermissionsDialog();
            IPermissionManagementDataAccessAgent agent = DataAccessFactory.GetInstance(new PermissionManagementDataAccessConfigurationView(DicomDemoSettingsManager.GetGlobalPacsConfiguration(), DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IPermissionManagementDataAccessAgent>();

            Permission[] permissions = agent.GetPermissions();

            permissionDialog.Username = e.Username;
            permissionDialog.SetPermissions(permissions, e.Permissions);
            permissionDialog.SetRoles(RoleManager.GetAllRoles(), RoleManager.GetUserRoles(e.Username));
            if (permissionDialog.ShowDialog() == DialogResult.OK)
            {
                View.UsersAccounts.SetUserPermissions(permissionDialog.SelectedPermissions);
                RoleManager.SetUserRoles(e.Username, permissionDialog.Roles);
                View_SettingsChanged(sender, e);
            }
        }
Exemplo n.º 7
0
        private void SetPermissions()
        {
            IPermissionManagementDataAccessAgent agent = DataAccessFactory.GetInstance(new PermissionManagementDataAccessConfigurationView(DicomDemoSettingsManager.GetGlobalPacsConfiguration(), DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IPermissionManagementDataAccessAgent>();

            _RolesView.SetPermissions(agent.GetPermissions());
        }
Exemplo n.º 8
0
        void OnUpdateServerSettings(object sender, EventArgs e)
        {
            if (_view != null)
            {
                IAeManagementDataAccessAgent         agent            = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent>();
                IPermissionManagementDataAccessAgent permissionsAgent = DataAccessServices.GetDataAccessService <IPermissionManagementDataAccessAgent>();

#if LEADTOOLS_V20_OR_LATER
                IOptionsDataAccessAgent optionsAgent = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>();

                if (optionsAgent != null)
                {
                    ClientConfigurationOptions clientConfigurationOptions = optionsAgent.Get <ClientConfigurationOptions>(ClientConfigurationOptionsKeyName, new ClientConfigurationOptions());
                    if (clientConfigurationOptions != null)
                    {
                        View.Options = clientConfigurationOptions;
                    }
                }
#endif // #if LEADTOOLS_V20_OR_LATER

                AeInfoExtended[] aeInfoExtendedArray = agent.GetAeTitles();
                List <string>    aeTitlesInDB        = new List <string>();

                foreach (AeInfoExtended ae in aeInfoExtendedArray)
                {
                    ClientInformation info = (from i in ServerState.Instance.ClientList.Items
                                              where i.Client.AETitle == ae.AETitle
                                              select i).FirstOrDefault();

                    //
                    // Only add items that existed when the database was first queried. If an ae title was added outside of this dialog
                    //  it will be ignored.
                    //
                    if (info != null)
                    {
                        aeTitlesInDB.Add(ae.AETitle.ToUpper());
                    }
                }

                // Updates and adds
                foreach (ClientInformation ci in _view.ClientInformationList.Items)
                {
                    string aeTitle = ci.Client.AETitle;
                    if (aeTitlesInDB.Contains(aeTitle, StringComparer.InvariantCultureIgnoreCase))
                    {
                        // update
                        ClientInformation ciPrevious = null;
                        ServerState.Instance.ClientList.ClientDictionary.TryGetValue(aeTitle, out ciPrevious);

                        if (!ciPrevious.Equals(ci))
                        {
                            agent.Update(aeTitle, ci.Client);
                        }
                        aeTitlesInDB.Remove(aeTitle.ToUpper());
                        try
                        {
                            EventBroker.Instance.PublishEvent <ClientUpdatedEventArgs>(this, new ClientUpdatedEventArgs(aeTitle, ci.Client));
                        }
                        catch { }
                    }
                    else
                    {
                        // insert
                        agent.Add(ci.Client);
                        try
                        {
                            EventBroker.Instance.PublishEvent <ClientAddedEventArgs>(this, new ClientAddedEventArgs(ci.Client));
                        }
                        catch { }
                    }
                    permissionsAgent.DeleteUserPermission(null, aeTitle);
                    foreach (string permissionName in ci.Permissions)
                    {
                        permissionsAgent.AddUserPermission(permissionName, aeTitle);
                    }
                }

                // Finally, remove the deleted AE titles from the database
                foreach (string aeTitle in aeTitlesInDB)
                {
                    agent.Remove(aeTitle);
                    try
                    {
                        EventBroker.Instance.PublishEvent <ClientRemovedEventArgs>(this, new ClientRemovedEventArgs(aeTitle));
                    }
                    catch { }
                }

                ServerState.Instance.ClientList = new ClientInformationList(_view.ClientInformationList);
            }
        }