Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7639


Ignore:
Timestamp:
03/20/12 13:39:59 (13 years ago)
Author:
ascheibe
Message:

#1648 added ui for assigning users to groups

Location:
branches/ClientUserManagement
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/UserGroupView.Designer.cs

    r7637 r7639  
    2828      this.groupNameTextBox = new System.Windows.Forms.TextBox();
    2929      this.idTextBox = new System.Windows.Forms.TextBox();
     30      this.refreshableLightweightUserView = new HeuristicLab.Clients.Access.Views.RefreshableLightweightUserView();
     31      this.storeButton = new System.Windows.Forms.Button();
    3032      this.SuspendLayout();
    3133      //
     
    5052      // groupNameTextBox
    5153      //
    52       this.groupNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    53             | System.Windows.Forms.AnchorStyles.Right)));
     54      this.groupNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     55                  | System.Windows.Forms.AnchorStyles.Right)));
    5456      this.groupNameTextBox.Location = new System.Drawing.Point(79, 3);
    5557      this.groupNameTextBox.Name = "groupNameTextBox";
    56       this.groupNameTextBox.Size = new System.Drawing.Size(282, 20);
     58      this.groupNameTextBox.Size = new System.Drawing.Size(675, 20);
    5759      this.groupNameTextBox.TabIndex = 2;
    5860      this.groupNameTextBox.TextChanged += new System.EventHandler(this.groupNameTextBox_TextChanged);
     
    6062      // idTextBox
    6163      //
    62       this.idTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    63             | System.Windows.Forms.AnchorStyles.Right)));
     64      this.idTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     65                  | System.Windows.Forms.AnchorStyles.Right)));
    6466      this.idTextBox.Enabled = false;
    6567      this.idTextBox.Location = new System.Drawing.Point(79, 29);
    6668      this.idTextBox.Name = "idTextBox";
    67       this.idTextBox.Size = new System.Drawing.Size(282, 20);
     69      this.idTextBox.Size = new System.Drawing.Size(675, 20);
    6870      this.idTextBox.TabIndex = 3;
     71      //
     72      // refreshableLightweightUserView
     73      //
     74      this.refreshableLightweightUserView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     75                  | System.Windows.Forms.AnchorStyles.Left)
     76                  | System.Windows.Forms.AnchorStyles.Right)));
     77      this.refreshableLightweightUserView.Caption = "RefreshableLightweightUser View";
     78      this.refreshableLightweightUserView.Content = null;
     79      this.refreshableLightweightUserView.FetchSelectedUsers = null;
     80      this.refreshableLightweightUserView.Location = new System.Drawing.Point(0, 55);
     81      this.refreshableLightweightUserView.Name = "refreshableLightweightUserView";
     82      this.refreshableLightweightUserView.ReadOnly = false;
     83      this.refreshableLightweightUserView.Size = new System.Drawing.Size(754, 282);
     84      this.refreshableLightweightUserView.TabIndex = 4;
     85      //
     86      // storeButton
     87      //
     88      this.storeButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb;
     89      this.storeButton.Location = new System.Drawing.Point(31, 58);
     90      this.storeButton.Name = "storeButton";
     91      this.storeButton.Size = new System.Drawing.Size(24, 24);
     92      this.storeButton.TabIndex = 5;
     93      this.storeButton.UseVisualStyleBackColor = true;
     94      this.storeButton.Click += new System.EventHandler(this.storeButton_Click);
    6995      //
    7096      // UserGroupView
     
    7298      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    7399      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     100      this.Controls.Add(this.storeButton);
     101      this.Controls.Add(this.refreshableLightweightUserView);
    74102      this.Controls.Add(this.idTextBox);
    75103      this.Controls.Add(this.groupNameTextBox);
     
    77105      this.Controls.Add(this.label1);
    78106      this.Name = "UserGroupView";
    79       this.Size = new System.Drawing.Size(364, 54);
     107      this.Size = new System.Drawing.Size(757, 340);
    80108      this.ResumeLayout(false);
    81109      this.PerformLayout();
     
    89117    private System.Windows.Forms.TextBox groupNameTextBox;
    90118    private System.Windows.Forms.TextBox idTextBox;
     119    private Views.RefreshableLightweightUserView refreshableLightweightUserView;
     120    private System.Windows.Forms.Button storeButton;
    91121  }
    92122}
  • branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/UserGroupView.cs

    r7637 r7639  
    2020#endregion
    2121
     22using System;
     23using System.Collections.Generic;
    2224using HeuristicLab.Core.Views;
    2325using HeuristicLab.MainForm;
     
    4244        groupNameTextBox.Clear();
    4345        idTextBox.Clear();
     46
     47        refreshableLightweightUserView.Content = null;
     48        refreshableLightweightUserView.FetchSelectedUsers = null;
    4449      } else {
    4550        groupNameTextBox.Text = Content.Name;
    4651        idTextBox.Text = Content.Id.ToString();
     52
     53        refreshableLightweightUserView.Content = Access.AccessClient.Instance;
     54        refreshableLightweightUserView.FetchSelectedUsers = new Func<List<Guid>>(delegate { return AccessAdministrationClient.CallAccessService<List<Guid>>(s => s.GetUserGroupIdsOfGroup(Content.Id)); });
    4755      }
    4856    }
     
    5260        Content.Name = this.groupNameTextBox.Text;
    5361    }
     62
     63    private void storeButton_Click(object sender, EventArgs e) {
     64      Action storeAction = new Action(delegate {
     65        foreach (var ug in refreshableLightweightUserView.GetCheckedUsers()) {
     66          AccessAdministrationClient.CallAccessService(s => s.AddUserGroupBaseToGroup(ug, Content));
     67        }
     68      });
     69
     70      Action deleteAction = new Action(delegate {
     71        foreach (var ug in refreshableLightweightUserView.GetDeletedUsers()) {
     72          AccessAdministrationClient.CallAccessService(s => s.RemoveUserGroupBaseFromGroup(ug, Content));
     73        }
     74      });
     75
     76      AccessAdministrationClient.Instance.ExecuteActionAsync(storeAction, PluginInfrastructure.ErrorHandling.ShowErrorDialog);
     77      AccessAdministrationClient.Instance.ExecuteActionAsync(deleteAction, PluginInfrastructure.ErrorHandling.ShowErrorDialog);
     78    }
    5479  }
    5580}
  • branches/ClientUserManagement/HeuristicLab.Clients.Access.Views/3.3/UserViews/RefreshableLightweightUserView.cs

    r7555 r7639  
    3838
    3939    //set an action like a webservice call to retrieve the users which should be marked as checked           
    40     public Func<List<Guid>> FetchSelectedUsers { get; set; }
     40    private Func<List<Guid>> fetchSelectedUsers;
     41    public Func<List<Guid>> FetchSelectedUsers {
     42      get { return fetchSelectedUsers; }
     43      set {
     44        fetchSelectedUsers = value;
     45        selectedUsers = null;
     46        lightweightUserView.Content = null;
     47      }
     48    }
     49
    4150    private List<Guid> selectedUsers;
     51
     52    protected override void OnContentChanged() {
     53      base.OnContentChanged();
     54
     55      selectedUsers = null;
     56      lightweightUserView.Content = null;
     57    }
    4258
    4359    protected override void RefreshData() {
     
    6682    }
    6783
     84    public IItemList<UserGroupBase> GetDeletedUsers() {
     85      if (lightweightUserView.Content == null) {
     86        return null;
     87      } else {
     88        var deletedIds = selectedUsers.Where(x => lightweightUserView.Content.Count(y => y.Id == x) == 0);
     89        List<UserGroupBase> deletedUGs = Content.UsersAndGroups.Where(x => deletedIds.Contains(x.Id)).ToList();
     90        return new ItemList<UserGroupBase>(deletedUGs);
     91      }
     92    }
     93
    6894    public IItemList<UserGroupBase> GetCheckedUsers() {
    69       return (lightweightUserView.Content == null) ? null : lightweightUserView.Content;
     95      return (lightweightUserView.Content == null) ? null : new ItemList<UserGroupBase>(lightweightUserView.Content.Where(x => !selectedUsers.Contains(x.Id)));
    7096    }
    7197
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/ServiceClients/AccessServiceClient.cs

    r7612 r7639  
    22// <auto-generated>
    33//     This code was generated by a tool.
    4 //     Runtime Version:4.0.30319.261
     4//     Runtime Version:4.0.30319.530
    55//
    66//     Changes to this file may cause incorrect behavior and will be lost if
     
    2828  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.ClientLog))]
    2929  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.UserGroupBase))]
     30  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.LightweightUser))]
    3031  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.UserGroup))]
    3132  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.User))]
    32   [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.LightweightUser))]
    3333  public partial class AccessItem : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {
    3434
     
    4646
    4747    public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
    48 
    49 
    5048  }
    5149
     
    665663      "")]
    666664  [System.SerializableAttribute()]
     665  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.LightweightUser))]
    667666  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.UserGroup))]
    668667  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.User))]
    669   [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.LightweightUser))]
    670668  public partial class UserGroupBase : HeuristicLab.Clients.Access.AccessItem {
    671669
     
    689687  [System.Diagnostics.DebuggerStepThroughAttribute()]
    690688  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
     689  [System.Runtime.Serialization.DataContractAttribute(Name = "LightweightUser", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Access.DataTransfer" +
     690      "")]
     691  [System.SerializableAttribute()]
     692  public partial class LightweightUser : HeuristicLab.Clients.Access.UserGroupBase {
     693
     694    [System.Runtime.Serialization.OptionalFieldAttribute()]
     695    private string FullNameField;
     696
     697    [System.Runtime.Serialization.OptionalFieldAttribute()]
     698    private System.Collections.Generic.List<HeuristicLab.Clients.Access.UserGroup> GroupsField;
     699
     700    [System.Runtime.Serialization.OptionalFieldAttribute()]
     701    private System.Collections.Generic.List<HeuristicLab.Clients.Access.Role> RolesField;
     702
     703    [System.Runtime.Serialization.OptionalFieldAttribute()]
     704    private string UserNameField;
     705
     706    [System.Runtime.Serialization.DataMemberAttribute()]
     707    public string FullName {
     708      get {
     709        return this.FullNameField;
     710      }
     711      set {
     712        if ((object.ReferenceEquals(this.FullNameField, value) != true)) {
     713          this.FullNameField = value;
     714          this.RaisePropertyChanged("FullName");
     715        }
     716      }
     717    }
     718
     719    [System.Runtime.Serialization.DataMemberAttribute()]
     720    public System.Collections.Generic.List<HeuristicLab.Clients.Access.UserGroup> Groups {
     721      get {
     722        return this.GroupsField;
     723      }
     724      set {
     725        if ((object.ReferenceEquals(this.GroupsField, value) != true)) {
     726          this.GroupsField = value;
     727          this.RaisePropertyChanged("Groups");
     728        }
     729      }
     730    }
     731
     732    [System.Runtime.Serialization.DataMemberAttribute()]
     733    public System.Collections.Generic.List<HeuristicLab.Clients.Access.Role> Roles {
     734      get {
     735        return this.RolesField;
     736      }
     737      set {
     738        if ((object.ReferenceEquals(this.RolesField, value) != true)) {
     739          this.RolesField = value;
     740          this.RaisePropertyChanged("Roles");
     741        }
     742      }
     743    }
     744
     745    [System.Runtime.Serialization.DataMemberAttribute()]
     746    public string UserName {
     747      get {
     748        return this.UserNameField;
     749      }
     750      set {
     751        if ((object.ReferenceEquals(this.UserNameField, value) != true)) {
     752          this.UserNameField = value;
     753          this.RaisePropertyChanged("UserName");
     754        }
     755      }
     756    }
     757  }
     758
     759  [System.Diagnostics.DebuggerStepThroughAttribute()]
     760  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    691761  [System.Runtime.Serialization.DataContractAttribute(Name = "UserGroup", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Access.DataTransfer" +
    692762      "")]
     
    845915          this.LastPasswordChangedDateField = value;
    846916          this.RaisePropertyChanged("LastPasswordChangedDate");
    847         }
    848       }
    849     }
    850 
    851     [System.Runtime.Serialization.DataMemberAttribute()]
    852     public string UserName {
    853       get {
    854         return this.UserNameField;
    855       }
    856       set {
    857         if ((object.ReferenceEquals(this.UserNameField, value) != true)) {
    858           this.UserNameField = value;
    859           this.RaisePropertyChanged("UserName");
    860         }
    861       }
    862     }
    863   }
    864 
    865   [System.Diagnostics.DebuggerStepThroughAttribute()]
    866   [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    867   [System.Runtime.Serialization.DataContractAttribute(Name = "LightweightUser", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Access.DataTransfer" +
    868       "")]
    869   [System.SerializableAttribute()]
    870   public partial class LightweightUser : HeuristicLab.Clients.Access.UserGroupBase {
    871 
    872     [System.Runtime.Serialization.OptionalFieldAttribute()]
    873     private string FullNameField;
    874 
    875     [System.Runtime.Serialization.OptionalFieldAttribute()]
    876     private System.Collections.Generic.List<HeuristicLab.Clients.Access.UserGroup> GroupsField;
    877 
    878     [System.Runtime.Serialization.OptionalFieldAttribute()]
    879     private System.Collections.Generic.List<HeuristicLab.Clients.Access.Role> RolesField;
    880 
    881     [System.Runtime.Serialization.OptionalFieldAttribute()]
    882     private string UserNameField;
    883 
    884     [System.Runtime.Serialization.DataMemberAttribute()]
    885     public string FullName {
    886       get {
    887         return this.FullNameField;
    888       }
    889       set {
    890         if ((object.ReferenceEquals(this.FullNameField, value) != true)) {
    891           this.FullNameField = value;
    892           this.RaisePropertyChanged("FullName");
    893         }
    894       }
    895     }
    896 
    897     [System.Runtime.Serialization.DataMemberAttribute()]
    898     public System.Collections.Generic.List<HeuristicLab.Clients.Access.UserGroup> Groups {
    899       get {
    900         return this.GroupsField;
    901       }
    902       set {
    903         if ((object.ReferenceEquals(this.GroupsField, value) != true)) {
    904           this.GroupsField = value;
    905           this.RaisePropertyChanged("Groups");
    906         }
    907       }
    908     }
    909 
    910     [System.Runtime.Serialization.DataMemberAttribute()]
    911     public System.Collections.Generic.List<HeuristicLab.Clients.Access.Role> Roles {
    912       get {
    913         return this.RolesField;
    914       }
    915       set {
    916         if ((object.ReferenceEquals(this.RolesField, value) != true)) {
    917           this.RolesField = value;
    918           this.RaisePropertyChanged("Roles");
    919917        }
    920918      }
     
    10761074    System.Collections.Generic.List<HeuristicLab.Clients.Access.UserGroupMapping> GetUserGroupMapping();
    10771075
     1076    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAccessService/GetUserGroupIdsOfGroup", ReplyAction = "http://tempuri.org/IAccessService/GetUserGroupIdsOfGroupResponse")]
     1077    System.Collections.Generic.List<System.Guid> GetUserGroupIdsOfGroup(System.Guid groupId);
     1078
    10781079    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAccessService/GetRoles", ReplyAction = "http://tempuri.org/IAccessService/GetRolesResponse")]
    10791080    System.Collections.Generic.List<HeuristicLab.Clients.Access.Role> GetRoles();
     
    12801281    }
    12811282
     1283    public System.Collections.Generic.List<System.Guid> GetUserGroupIdsOfGroup(System.Guid groupId) {
     1284      return base.Channel.GetUserGroupIdsOfGroup(groupId);
     1285    }
     1286
    12821287    public System.Collections.Generic.List<HeuristicLab.Clients.Access.Role> GetRoles() {
    12831288      return base.Channel.GetRoles();
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs

    r7637 r7639  
    716716      }
    717717    }
     718
     719    public IEnumerable<Guid> GetUserGroupIdsOfGroup(Guid groupId) {
     720      using (DA.AccessServiceDataContext context = new DA.AccessServiceDataContext()) {
     721        var query = from u in context.UserGroupUserGroups
     722                    where u.UserGroupUserGroupId == groupId
     723                    select u.UserGroupId;
     724        return query.ToList();
     725      }
     726    }
    718727    #endregion
    719728
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/IAccessService.cs

    r7612 r7639  
    187187    [OperationContract]
    188188    IEnumerable<UserGroupMapping> GetUserGroupMapping();
     189
     190    [OperationContract]
     191    IEnumerable<Guid> GetUserGroupIdsOfGroup(Guid groupId);
    189192    #endregion
    190193
Note: See TracChangeset for help on using the changeset viewer.