Changeset 8075 for trunk/sources/HeuristicLab.Clients.Hive.Administrator
- Timestamp:
- 06/21/12 12:46:54 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/HiveRoles.cs
r8051 r8075 31 31 32 32 public static bool CheckAdminUserPermissions() { 33 UserInformation.Instance.Refresh();34 33 return UserInformation.Instance.UserExists && UserInformation.Instance.User.Roles.Any(x => x.Name == HiveRoles.Administrator); 35 34 } -
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.Designer.cs
r8074 r8075 40 40 HiveAdminClient.Instance.Refreshed -= new EventHandler(Instance_Refreshed); 41 41 42 Access.AccessClient.Instance.Refreshing -= new EventHandler( Content_Refreshing);43 Access.AccessClient.Instance.Refreshed -= new EventHandler( Content_Refreshed);42 Access.AccessClient.Instance.Refreshing -= new EventHandler(AccessClient_Refreshing); 43 Access.AccessClient.Instance.Refreshed -= new EventHandler(AccessClient_Refreshed); 44 44 base.Dispose(disposing); 45 45 } -
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs
r8074 r8075 61 61 HiveAdminClient.Instance.Refreshed += new EventHandler(Instance_Refreshed); 62 62 63 Access.AccessClient.Instance.Refreshing += new EventHandler( Content_Refreshing);64 Access.AccessClient.Instance.Refreshed += new EventHandler( Content_Refreshed);63 Access.AccessClient.Instance.Refreshing += new EventHandler(AccessClient_Refreshing); 64 Access.AccessClient.Instance.Refreshed += new EventHandler(AccessClient_Refreshed); 65 65 } 66 66 … … 89 89 progressTask = new TS.Task(UpdateProgress); 90 90 progressTask.Start(); 91 SetEnabledStateOfControls( false);91 SetEnabledStateOfControls(); 92 92 } 93 93 94 94 void Instance_Refreshed(object sender, EventArgs e) { 95 95 stopProgressTask = true; 96 SetEnabledStateOfControls( true);97 } 98 99 void Content_Refreshing(object sender, EventArgs e) {96 SetEnabledStateOfControls(); 97 } 98 99 void AccessClient_Refreshing(object sender, EventArgs e) { 100 100 stopProgressTask = false; 101 101 progressTask = new TS.Task(UpdateProgress); 102 102 progressTask.Start(); 103 SetEnabledStateOfControls( false);104 } 105 106 void Content_Refreshed(object sender, EventArgs e) {103 SetEnabledStateOfControls(); 104 } 105 106 void AccessClient_Refreshed(object sender, EventArgs e) { 107 107 stopProgressTask = true; 108 SetEnabledStateOfControls( true);108 SetEnabledStateOfControls(); 109 109 } 110 110 … … 199 199 btnPermissionsSave.Enabled = false; 200 200 permissionView.Enabled = false; 201 scheduleView.SetEnabledStateOfSchedule(false); 202 btnPermissionsSave.Enabled = false; 203 permissionView.Enabled = false; 201 204 } else { 202 205 btnAddGroup.Enabled = true; 203 206 btnRemoveGroup.Enabled = true; 204 207 btnSave.Enabled = true; 205 } 206 } 207 208 public virtual void SetEnabledStateOfControls(bool state) { 209 if (InvokeRequired) { 210 Invoke(new Action(() => SetEnabledStateOfControls(state))); 211 } else { 212 if (Content == null) state = false; 213 btnAddGroup.Enabled = state; 214 btnRemoveGroup.Enabled = state; 215 btnSave.Enabled = state; 216 scheduleView.SetEnabledStateOfControls(state && IsAuthorized(slaveView.Content)); 217 btnPermissionsSave.Enabled = state && permissionView.FetchSelectedUsers != null && Content != null; 218 permissionView.Enabled = state && permissionView.FetchSelectedUsers != null && Content != null; 208 scheduleView.SetEnabledStateOfSchedule(IsAuthorized(slaveView.Content)); 209 btnPermissionsSave.Enabled = permissionView.FetchSelectedUsers != null; 210 permissionView.Enabled = permissionView.FetchSelectedUsers != null; 219 211 } 220 212 } … … 483 475 scheduleView.Invoke(new Action(() => { 484 476 scheduleView.Content = HiveAdminClient.Instance.Downtimes; 485 SetEnabledStateOfControls( currentlyAuthorized);477 SetEnabledStateOfControls(); 486 478 })); 487 479 } … … 526 518 527 519 private void btnPermissionsSave_Click(object sender, EventArgs e) { 528 SetEnabledStateOfControls( false);520 SetEnabledStateOfControls(); 529 521 HiveServiceLocator.Instance.CallHiveService(service => { 530 522 service.GrantResourcePermissions(((Resource)treeSlaveGroup.SelectedNode.Tag).Id, permissionView.GetAddedUsers().Select(x => x.Id).ToList()); 531 523 service.RevokeResourcePermissions(((Resource)treeSlaveGroup.SelectedNode.Tag).Id, permissionView.GetDeletedUsers().Select(x => x.Id).ToList()); 532 524 }); 533 SetEnabledStateOfControls( true);525 SetEnabledStateOfControls(); 534 526 } 535 527 } -
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs
r8051 r8075 230 230 } 231 231 232 public virtual void SetEnabledStateOf Controls(bool state) {232 public virtual void SetEnabledStateOfSchedule(bool state) { 233 233 if (InvokeRequired) { 234 Invoke(new Action(() => SetEnabledStateOf Controls(state)));234 Invoke(new Action(() => SetEnabledStateOfSchedule(state))); 235 235 } else { 236 236 if (Content == null) state = false;
Note: See TracChangeset
for help on using the changeset viewer.