private void storeButton_Click(object sender, EventArgs e)
        {
            List <Role> addedRoles   = new List <Role>();
            List <Role> deletedRoles = new List <Role>();

            foreach (ListViewItem lstRole in roleSelectionListView.ItemsListView.Items)
            {
                if (!CurrentRoles.Contains(((Role)lstRole.Tag)) && lstRole.Checked)
                {
                    addedRoles.Add((Role)lstRole.Tag);
                    CurrentRoles.Add((Role)lstRole.Tag);
                }

                if (CurrentRoles.Contains(((Role)lstRole.Tag)) && !lstRole.Checked)
                {
                    deletedRoles.Add((Role)lstRole.Tag);
                    CurrentRoles.Remove((Role)lstRole.Tag);
                }
            }

            Content.ExecuteActionAsync(new Action(delegate {
                foreach (var role in addedRoles)
                {
                    AccessAdministrationClient.CallAccessService(s => s.AddUserToRole(role, CurrentUser));
                }

                foreach (var role in deletedRoles)
                {
                    AccessAdministrationClient.CallAccessService(s => s.RemoveUserFromRole(role, CurrentUser));
                }
            }), PluginInfrastructure.ErrorHandling.ShowErrorDialog);
        }
Ejemplo n.º 2
0
        private void resetPasswordButton_Click(object sender, System.EventArgs e)
        {
            Action a = new Action(delegate {
                string result = AccessAdministrationClient.CallAccessService <string>(s => s.ResetPassword(Content.Id));
                ShowPassword(result);
            });

            AccessAdministrationClient.Instance.ExecuteActionAsync(a, PluginInfrastructure.ErrorHandling.ShowErrorDialog);;
        }
 protected override void RefreshData() {
   if (CurrentUser != null) {
     Content.ExecuteActionAsync(new Action(delegate {
       if (Content.Roles == null) {
         Content.RefreshRoles();
       }
       CurrentRoles = AccessAdministrationClient.CallAccessService<List<Role>>(s => s.GetUserRoles(CurrentUser));
     }), PluginInfrastructure.ErrorHandling.ShowErrorDialog);
   }
 }
Ejemplo n.º 4
0
        private void storeButton_Click(object sender, EventArgs e)
        {
            Action storeAction = new Action(delegate {
                foreach (var ug in refreshableLightweightUserView.GetAddedUsers())
                {
                    AccessAdministrationClient.CallAccessService(s => s.AddUserGroupBaseToGroup(ug, Content));
                }
            });

            Action deleteAction = new Action(delegate {
                foreach (var ug in refreshableLightweightUserView.GetDeletedUsers())
                {
                    AccessAdministrationClient.CallAccessService(s => s.RemoveUserGroupBaseFromGroup(ug, Content));
                }
            });

            AccessAdministrationClient.Instance.ExecuteActionAsync(storeAction, PluginInfrastructure.ErrorHandling.ShowErrorDialog);
            AccessAdministrationClient.Instance.ExecuteActionAsync(deleteAction, PluginInfrastructure.ErrorHandling.ShowErrorDialog);
        }
Ejemplo n.º 5
0
        protected override void OnContentChanged()
        {
            base.OnContentChanged();

            if (Content == null)
            {
                groupNameTextBox.Clear();
                idTextBox.Clear();

                refreshableLightweightUserView.Content            = null;
                refreshableLightweightUserView.FetchSelectedUsers = null;
            }
            else
            {
                groupNameTextBox.Text = Content.Name;
                idTextBox.Text        = Content.Id.ToString();

                refreshableLightweightUserView.Content            = Content.Id != Guid.Empty ? Access.AccessClient.Instance : null;
                refreshableLightweightUserView.FetchSelectedUsers = Content.Id != Guid.Empty ? new Func <List <Guid> >(delegate { return(AccessAdministrationClient.CallAccessService <List <Guid> >(s => s.GetUserGroupIdsOfGroup(Content.Id))); }) : null;
            }
        }