Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/28/10 10:34:08 (14 years ago)
Author:
mholper
Message:

implemented Method HeuristicLabRoleProvider.GetUsersInRoleTest and UnitTest (#1046)

File:
1 edited

Legend:

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

    r3964 r3967  
    101101
    102102    public override string[] GetUsersInRole(string roleName) {
    103       throw new NotImplementedException();
     103      List<string> userList = new List<string>();
     104      DataClassesDataContext context = DatabaseUtil.createDataClassesDataContext();
     105      if (roleName != null && context.HeuristicLabRole.Count(r => r.RoleName == roleName) > 0) {
     106
     107        Persistence.HeuristicLabRole role = context.HeuristicLabRole.Single(r => r.RoleName == roleName);
     108        foreach (Persistence.HeuristicLabUserRole roleUser in role.HeuristicLabUserRoles) {
     109          if(!userList.Contains(roleUser.HeuristicLabUser.UserName))
     110            userList.Add(roleUser.HeuristicLabUser.UserName);
     111        }
     112      }
     113      context.Dispose();
     114      return userList.ToArray();
    104115    }
    105116
     
    121132
    122133      Persistence.DataClassesDataContext db = DatabaseUtil.createDataClassesDataContext();
    123       bool returnValue = (DatabaseUtil.createDataClassesDataContext().HeuristicLabRole.Count(r => r.RoleName == roleName) == 1);
     134      bool returnValue = (db.HeuristicLabRole.Count(r => r.RoleName == roleName) == 1);
    124135      db.Dispose();
    125136      return returnValue;
Note: See TracChangeset for help on using the changeset viewer.