Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/29/10 20:00:06 (14 years ago)
Author:
bfarka
Message:

fixed bug in RomveUsersFromRoles and fixed some tests (1046)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabRoleProvider.cs

    r3967 r3978  
    126126
    127127    public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames) {
    128       throw new NotImplementedException();
     128
     129      DataClassesDataContext context = DatabaseUtil.createDataClassesDataContext();
     130
     131      foreach (string userName in usernames) {
     132        if (userName != null && context.HeuristicLabUsers.Count(u => u.UserName == userName) > 0) {
     133          Persistence.HeuristicLabUser user = context.HeuristicLabUsers.Single(u => u.UserName == userName);
     134          foreach (Persistence.HeuristicLabUserRole userRole in user.HeuristicLabUserRoles) {
     135            if (roleNames.Contains(userRole.HeuristicLabRole.RoleName)) {
     136              context.HeuristicLabUserRole.DeleteOnSubmit(userRole);
     137              //deleteList.Add(userRole);
     138            }//if
     139          }//foreach
     140        }//if
     141      }//foreach
     142      context.SubmitChanges();
     143      context.Dispose();
    129144    }
    130145
Note: See TracChangeset for help on using the changeset viewer.