示例#1
0
        private void btExportXML_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                saveFileDialog1.Filter = "XML files|*.xml";

                if (this.saveFileDialog1.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var users        = MDSWrapper.UserSecurityPrincipalsGet();
                var groups       = MDSWrapper.GroupSecurityPrincipalsGet();
                var securityinfo = new SecurityInformation(users.Users, groups.Groups);


                MDSWrapper.SecurityPrincipalsExport(this.saveFileDialog1.FileName, securityinfo);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
示例#2
0
        private void LoadSecurityPrincipals()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                var users = MDSWrapper.UserSecurityPrincipalsGet();
                lstUsers.Items.Clear();
                foreach (User u in users.Users)
                {
                    this.lstUsers.Items.Add(new CustomUser(u));
                }

                //Note the security principals are server-level objects, not model specific
                var groups = MDSWrapper.GroupSecurityPrincipalsGet();
                lstGroups.Items.Clear();
                foreach (Group group in groups.Groups)
                {
                    this.lstGroups.Items.Add(new CustomGroup(group));
                }
            }
            catch (Exception ex)
            {
                statusStrip1.Text = ex.Message;
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
示例#3
0
        public void GroupSecurityPrincipalsGetTest()
        {
            //var model = _wrapper.GetModelByName(modelName, global::Common.MDSService.ResultType.Identifiers);
            var users = MDSWrapper.GroupSecurityPrincipalsGet();

            Trace.Write("Groups from instance:");
            foreach (User user in users.Users)
            {
                Trace.Write(user.DisplayName);
            }
            Assert.IsNotNull(users.Users);
        }
示例#4
0
        private void RefreshPermissionsList(object sender)
        {
            try
            {
                DataGridView ruleDataGrid = null;
                if (sender == cbConnection.ComboBox)
                {
                    ruleDataGrid = dgRules;
                }

                if (sender == cbConnection2.ComboBox)
                {
                    ruleDataGrid = dgRules2;
                }

                Cursor.Current = Cursors.WaitCursor;
                var dataSet = MDSDataUtils.NewPermissionDataTable();

                var users = MDSWrapper.UserSecurityPrincipalsGet();

                foreach (var user in users.Users)
                {
                    foreach (var modelPrivilege in user.SecurityPrivilege.ModelPrivileges)
                    {
                        MDSDataUtils.NewPermissionDataRow(dataSet, user.Identifier, modelPrivilege);
                    }
                    foreach (var hierarchPrivilege in user.SecurityPrivilege.HierarchyMemberPrivileges)
                    {
                        MDSDataUtils.NewPermissionDataRow(dataSet, user.Identifier, hierarchPrivilege);
                    }
                }

                var groups = MDSWrapper.GroupSecurityPrincipalsGet();

                foreach (var group in groups.Groups)
                {
                    foreach (var modelPrivilege in group.SecurityPrivilege.ModelPrivileges)
                    {
                        MDSDataUtils.NewPermissionDataRow(dataSet, group.Identifier, modelPrivilege);
                    }
                    foreach (var hierarchPrivilege in group.SecurityPrivilege.HierarchyMemberPrivileges)
                    {
                        MDSDataUtils.NewPermissionDataRow(dataSet, group.Identifier, hierarchPrivilege);
                    }
                }

                ruleDataGrid.DataSource = dataSet;
                //hiding the column ID
                ruleDataGrid.Columns[0].Visible = false;

                btExport.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }