/// <summary>
        /// Displays the add/edit device dialog box.
        /// </summary>
        public void Show()
        {
            //If the validation failed, keep everything as is, and 
            //make sure the dialog stays visible.
            if (!Page.IsValid)
            {
                ModalDialog.Show();
                return;
            }

            if (Thread.CurrentPrincipal.IsInRole(ClearCanvas.ImageServer.Enterprise.Authentication.AuthorityTokens.Study.EditDataAccess) && Study != null)
            {
                AuthorityGroupCheckBoxList.Items.Clear();

                var controller = new StudyDataAccessController();
                var list = controller.ListDataAccessGroupsForStudy(Study.TheStudyStorage.Key);

                var adapter = new ServerPartitionDataAdapter();
                IList<AuthorityGroupDetail> accessAllStudiesList;
                var groups = adapter.GetAuthorityGroupsForPartition(Study.ThePartition.Key, true, out accessAllStudiesList);


                IList<ListItem> items = CollectionUtils.Map(
                    accessAllStudiesList,
                    delegate(AuthorityGroupDetail group)
                        {

                            var item = new ListItem(@group.Name,
                                                    @group.AuthorityGroupRef.ToString(false, false))
                                           {
                                               Enabled = false,
                                               Selected = true
                                           };
                            item.Attributes["title"] = @group.Description;
                            return item;
                        });

                foreach (var group in groups)
                {
                    var item = new ListItem(@group.Name,
                                              @group.AuthorityGroupRef.ToString(false, false));
                    item.Attributes["title"] = @group.Description;

                    foreach (AuthorityGroupStudyAccessInfo s in list)
                    {
                        if (s.AuthorityOID.Equals(group.AuthorityGroupRef.ToString(false, false)))
                            item.Selected = true;
                    }

                    items.Add(item);
                }

                AuthorityGroupCheckBoxList.Items.AddRange(CollectionUtils.ToArray(items));
            }

            CancelButton.Visible = true;
            UpdateButton.Visible = true;

            ModalDialog.Show();
        }
Beispiel #2
0
        public override void DataBind()
        {
            if (Study != null)
            {
                if (Thread.CurrentPrincipal.IsInRole(ClearCanvas.ImageServer.Enterprise.Authentication.AuthorityTokens.Study.EditDataAccess))
                {
                    StudyDataAccessController controller = new StudyDataAccessController();

                    var dataAccessGroupList = CollectionUtils.Sort(controller.ListDataAccessGroupsForStudy(Study.TheStudyStorage.Key), Compare);
                    UpdatableDataAccessGroupsGridView.DataSource = dataAccessGroupList;


                    var tokenAccessGroupList = CollectionUtils.Sort(controller.ListAuthorityGroupsForStudyViaToken(Study.TheStudyStorage), Compare);
                    OtherGroupsWithAccessGridView.DataSource = tokenAccessGroupList;
                    OtherGroupsListing.Visible = tokenAccessGroupList.Count > 0;

                    LinkToOtherGroupListing.Visible = dataAccessGroupList.Count > 10;

                }
            }

            base.DataBind();
        }