- Timestamp:
- 04/01/16 16:34:14 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/AccessAdministrationClient.cs
r13741 r13742 27 27 using HeuristicLab.Clients.Hive.WebJobManager.ViewModels; 28 28 using HeuristicLab.Clients.Hive.WebJobManager.Services; 29 using System.Collections.Generic; 29 30 30 31 namespace HeuristicLab.Clients.Access.Administration … … 169 170 } 170 171 172 /* BROKEN 171 173 public void DeleteUserGroup(UserGroup u) 172 174 { … … 179 181 ExecuteActionAsync(deleteUserGroupAction, exceptionCallback); 180 182 } 181 183 */ 182 184 public void DeleteRole(Role u) 183 185 { … … 233 235 #endregion 234 236 237 #region User 238 239 public string resetPassword(Guid id) 240 { 241 return CallAccessService<string>(s => s.ResetPassword(id)); 242 } 243 public Guid addUser(Access.User u) 244 { 245 return CallAccessService(s => s.AddUser(u).Id); 246 } 247 248 public void updateUser(Access.User u) 249 { 250 251 CallAccessService(s => s.UpdateUser(u)); 252 } 253 #endregion 254 255 #region Group 256 public Guid addGroup(Access.UserGroup g) 257 { 258 return CallAccessService(s => s.AddUserGroup(g)); 259 } 260 public void updateGroup(UserGroup g) 261 { 262 CallAccessService(s => s.UpdateUserGroup(g)); 263 } 264 public List<Access.UserGroup> getSubscribedGroups(Guid id) 265 { 266 var maps = CallAccessService(s => s.GetUserGroupMapping()); 267 maps = maps.FindAll(x => x.Child == id); 268 269 RefreshUserGroups(); 270 RefreshUsers(); 271 272 List<Access.UserGroup> members = new List<Access.UserGroup>(); 273 foreach (var map in maps) 274 { 275 UserGroup g = Groups.Find(x => x.Id == map.Parent); 276 if (g != null) 277 { 278 members.Add( g); 279 } 280 } 281 return members; 282 } 283 public List<Access.UserGroupBase> getGroupMembers(Guid id) 284 { 285 var maps = CallAccessService(s => s.GetUserGroupMapping()); 286 maps = maps.FindAll(x => x.Parent == id); 287 288 RefreshUserGroups(); 289 RefreshUsers(); 290 291 List<Access.UserGroupBase> members = new List<Access.UserGroupBase>(); 292 foreach (var map in maps) 293 { 294 User t = users.Find(x => x.Id == map.Child); 295 if (t == null) 296 { 297 UserGroup g = Groups.Find(x => x.Id == map.Child); 298 if (g != null) 299 { 300 members.Insert(0,g);//Groups always in the front 301 } 302 } 303 else 304 { 305 members.Add(t);//members in the back 306 } 307 } 308 return members; 309 } 310 311 public void deleteUserGroup(UserGroup group) 312 { 313 deleteAllMembers(group); 314 CallAccessService(s => s.DeleteUserGroup(group)); 315 } 316 private void deleteAllMembers(UserGroup group) 317 { 318 var list = getGroupMembers(group.Id); 319 foreach (var member in list) 320 {//Empties all member connections 321 CallAccessService(s => s.RemoveUserGroupBaseFromGroup(member, group)); 322 } 323 } 324 public void addMember(UserGroupBase member, UserGroup group) 325 { 326 CallAccessService(s => s.AddUserGroupBaseToGroup(member, group)); 327 } 328 public void deleteMember(UserGroupBase member,UserGroup group) 329 { 330 CallAccessService(s => s.RemoveUserGroupBaseFromGroup(member, group)); 331 } 332 #endregion 333 235 334 #region Helpers 236 public string resetPassword(Guid id)237 {238 return CallAccessService<string>(s => s.ResetPassword(id));239 }240 public Guid addUser(Access.User u)241 {242 return CallAccessService(s => s.AddUser(u).Id);243 }244 public void updateUser(Access.User u)245 {246 CallAccessService(s => s.UpdateUser(u));247 }248 public void deleteUser(Access.User u)249 {250 CallAccessService(s => s.DeleteUser(u));251 }252 335 private void getAccessClient() 253 336 {
Note: See TracChangeset
for help on using the changeset viewer.