Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/18/12 15:16:16 (12 years ago)
Author:
ascheibe
Message:

#1648 added roles management

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/AccessAdministrationClient.cs

    r7637 r7848  
    4545
    4646    public ItemList<UserGroup> Groups { get; set; }
     47    public ItemList<Role> Roles { get; set; }
    4748    #endregion
    4849
     
    6768      ExecuteActionAsync(RefreshUserGroups, exceptionCallback);
    6869    }
     70
     71    public void RefreshRoles() {
     72      Roles = new ItemList<Role>();
     73      Roles.AddRange(CallAccessService<ItemList<Role>>(s => new ItemList<Role>(s.GetRoles())));
     74    }
     75
     76    public void RefreshRolesAsync(Action<Exception> exceptionCallback) {
     77      ExecuteActionAsync(RefreshRoles, exceptionCallback);
     78    }
     79
    6980    #endregion
    7081
     
    104115    }
    105116
     117    public void StoreRoles() {
     118      foreach (Role g in Roles) {
     119        if (g.Modified) {
     120          CallAccessService(s => s.AddRole(g));
     121          g.SetUnmodified();
     122        }
     123      }
     124    }
     125
     126    public void StoreRolesAsync(Action<Exception> exceptionCallback) {
     127      ExecuteActionAsync(StoreRoles, exceptionCallback);
     128    }
     129
    106130    //i don't think such a generic method is a good idea
    107131    /*public static void Store(IAccessItem item) {
     
    127151      Action deleteUserGroupAction = new Action(delegate { DeleteUserGroup(u); });
    128152      ExecuteActionAsync(deleteUserGroupAction, exceptionCallback);
     153    }
     154
     155    public void DeleteRole(Role u) {
     156      CallAccessService(s => s.DeleteRole(u));
     157    }
     158
     159    public void DeleteRoleAsync(Role u, Action<Exception> exceptionCallback) {
     160      Action deleteRoleAction = new Action(delegate { DeleteRole(u); });
     161      ExecuteActionAsync(deleteRoleAction, exceptionCallback);
    129162    }
    130163    #endregion
Note: See TracChangeset for help on using the changeset viewer.