- Timestamp:
- 06/25/10 20:22:24 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabRoleProvider.cs
r3951 r3952 3 3 using System.Linq; 4 4 using Persistence; 5 using System.Text; 6 using System.Collections.Generic; 5 7 6 8 namespace Service.Provider { … … 32 34 33 35 public override string[] GetAllRoles() { 34 throw new NotImplementedException(); 36 List<string> roleList = new List<string>(); 37 38 List<HeuristicLabRole> roles = new List<HeuristicLabRole>(DatabaseUtil.createDataClassesDataContext().HeuristicLabRole.Select(r => r)); 39 foreach(HeuristicLabRole r in roles) 40 { 41 roleList.Add(r.RoleName); 42 } 43 44 return roleList.ToArray(); 35 45 } 36 46 37 47 public override string[] GetRolesForUser(string username) { 38 throw new NotImplementedException(); 48 List<string> roleList = new List<string>(); 49 DataClassesDataContext context = DatabaseUtil.createDataClassesDataContext(); 50 if (username != null && context.HeuristicLabUsers.Count(u => u.UserName == username) > 0) { 51 52 Persistence.HeuristicLabUser user = context.HeuristicLabUsers.Single(u => u.UserName == username); 53 foreach (Persistence.HeuristicLabUserRole userRole in user.HeuristicLabUserRole) { 54 roleList.Add(userRole.HeuristicLabRole.RoleName); 55 } 56 } 57 context.Dispose(); 58 return roleList.ToArray(); 39 59 } 40 60
Note: See TracChangeset
for help on using the changeset viewer.