コード例 #1
0
        public AuthorizationDialog(string url, string application, string user) : this()
        {
            m_Url = url;
            m_ApplicationTextBox.Text = application;
            m_UserComboBox.Text       = user;

            using (RoleManagerProxy roleManager = new RoleManagerProxy(url))
            {
                string[] roles = roleManager.GetAllRoles(application);

                m_RoleComboBox.Items.AddRange(roles);
                if (roles.Length > 0)
                {
                    m_RoleComboBox.Text = roles[roles.Length - 1];
                }

                using (MembershipManagerProxy membershipManager = new MembershipManagerProxy(url))
                {
                    string[] users = membershipManager.GetAllUsers(application);

                    m_UserComboBox.Items.AddRange(users);
                    if (users.Length > 0)
                    {
                        m_UserComboBox.Text = users[users.Length - 1];
                    }
                }
            }
        }
コード例 #2
0
 void OnCreateRole(object sender, EventArgs e)
 {
     using (RoleManagerProxy roleManager = new RoleManagerProxy(m_Url))
     {
         string[]           roles  = roleManager.GetAllRoles(m_Application);
         Predicate <string> exists = delegate(string role)
         {
             return(role == m_RoleTextBox.Text);
         };
         if (Array.Exists(roles, exists))
         {
             m_RoleValidator.SetError(m_RoleTextBox, "Role already exists");
             return;
         }
         m_RoleValidator.Clear();
         if (m_RoleTextBox.Text == String.Empty)
         {
             m_RoleValidator.SetError(m_RoleTextBox, "Role cannot be empty");
             return;
         }
         m_RoleValidator.Clear();
         roleManager.CreateRole(m_Application, m_RoleTextBox.Text);
         m_Roles.Add(m_RoleTextBox.Text);
         m_CreatedRolesListView.AddItem(m_RoleTextBox.Text, true);
         m_RoleTextBox.Focus();
         m_RoleTextBox.Text = String.Empty;
     }
 }
コード例 #3
0
ファイル: NewRoleDialog.cs プロジェクト: ittray/LocalDemo
      void OnCreateRole(object sender,EventArgs e)
      {
         using(RoleManagerProxy roleManager = new RoleManagerProxy(m_Url))
         {
            string[] roles = roleManager.GetAllRoles(m_Application);

            if(roles.Any(role => role == m_RoleTextBox.Text))
            {
               m_RoleValidator.SetError(m_RoleTextBox,"Role already exists");
               return;
            }
            m_RoleValidator.Clear();
            if(m_RoleTextBox.Text == String.Empty)
            {
               m_RoleValidator.SetError(m_RoleTextBox,"Role cannot be empty");
               return;
            }
            m_RoleValidator.Clear();
            roleManager.CreateRole(m_Application,m_RoleTextBox.Text);
            m_Roles.Add(m_RoleTextBox.Text);
            m_CreatedRolesListView.AddItem(m_RoleTextBox.Text,true);
            m_RoleTextBox.Focus();
            m_RoleTextBox.Text = String.Empty;
         }
      }
コード例 #4
0
      public AuthorizationDialog(string url,string application,string user) : this()
      {
         m_Url = url;
         m_ApplicationTextBox.Text = application;
         m_UserComboBox.Text = user;

         using(RoleManagerProxy roleManager = new RoleManagerProxy(url))
         {
            string[] roles = roleManager.GetAllRoles(application);

            m_RoleComboBox.Items.AddRange(roles);
            if(roles.Length > 0)
            {
               m_RoleComboBox.Text = roles[roles.Length-1];
            }

            using(MembershipManagerProxy membershipManager = new MembershipManagerProxy(url))
            {

               string[] users = membershipManager.GetAllUsers(application);

               m_UserComboBox.Items.AddRange(users);
               if(users.Length > 0)
               {
                  m_UserComboBox.Text = users[users.Length-1];
               }
            }
         }
      }
コード例 #5
0
 void RefreshRolesListView()
 {
     m_RolesListView.ClearItems();
     if (ApplicationName == String.Empty)
     {
         return;
     }
     using (RoleManagerProxy roleManager = new RoleManagerProxy(ServiceAddress))
     {
         string[] roles = roleManager.GetAllRoles(ApplicationName);
         m_RolesListView.AddItems(roles, true);
     }
 }
コード例 #6
0
 void RefreshRolesListView()
 {
    m_RolesListView.ClearItems();
    if(ApplicationName == String.Empty)
    {
       return;
    }
    using(RoleManagerProxy roleManager = new RoleManagerProxy(ServiceAddress))
    {
       string[] roles = roleManager.GetAllRoles(ApplicationName);
       m_RolesListView.AddItems(roles,true);
    }
 }