Changeset 3954


Ignore:
Timestamp:
06/26/10 08:13:12 (9 years ago)
Author:
bfarka
Message:

implemented RoleProvider.FindUsersInRole (#1046)

File:
1 edited

Legend:

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

    r3953 r3954  
    4040
    4141    public override string[] FindUsersInRole(string roleName, string usernameToMatch) {
    42       throw new NotImplementedException("not implemented");
     42      List<string> returnValue = new List<string>();
     43      Persistence.DataClassesDataContext db = DatabaseUtil.createDataClassesDataContext();
     44      if (roleName != null && db.HeuristicLabRole.Count(r => r.RoleName == roleName) == 1) {
     45        HeuristicLabRole role = db.HeuristicLabRole.Single(r => r.RoleName == roleName);
     46        foreach(HeuristicLabUserRole userRole in role.HeuristicLabUserRole)
     47        {
     48          if (userRole.HeuristicLabUser.UserName.Contains(usernameToMatch)) {
     49            returnValue.Add(userRole.HeuristicLabUser.UserName);
     50          }
     51        }
     52       }
     53      db.Dispose();
     54      return returnValue.ToArray();
    4355    }
    4456
Note: See TracChangeset for help on using the changeset viewer.