- Timestamp:
- 06/26/10 13:11:44 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabRoleProvider.cs
r3963 r3964 24 24 } 25 25 db.SubmitChanges(); 26 db.Dispose(); 26 27 } 27 28 } … … 49 50 db.HeuristicLabRole.InsertOnSubmit(role); 50 51 db.SubmitChanges(); 52 db.Dispose(); 51 53 } 52 54 } … … 74 76 List<string> roleList = new List<string>(); 75 77 76 List<HeuristicLabRole> roles = new List<HeuristicLabRole>(DatabaseUtil.createDataClassesDataContext().HeuristicLabRole.Select(r => r)); 78 Persistence.DataClassesDataContext db = DatabaseUtil.createDataClassesDataContext(); 79 List<HeuristicLabRole> roles = new List<HeuristicLabRole>(db.HeuristicLabRole.Select(r => r)); 77 80 foreach (HeuristicLabRole r in roles) { 78 81 roleList.Add(r.RoleName); 79 82 } 83 db.Dispose(); 80 84 81 85 return roleList.ToArray(); … … 100 104 } 101 105 102 103 /// <summary>104 /// true if given username has exists in given Role, else false105 /// </summary>106 /// <param name="username"></param>107 /// <param name="roleName"></param>108 /// <returns>bool</returns>109 106 public override bool IsUserInRole(string username, string roleName) { 110 111 112 if (username != null && roleName != null)113 {114 returnValue = (context.HeuristicLabUserRole.Count(ur => ur.HeuristicLabRole.RoleName == roleName && ur.HeuristicLabUser.UserName == username) > 0);115 }116 107 bool returnValue = false; 108 DataClassesDataContext context = DatabaseUtil.createDataClassesDataContext(); 109 if (username != null && roleName != null) { 110 returnValue = (context.HeuristicLabUserRole.Count(ur => ur.HeuristicLabRole.RoleName == roleName && ur.HeuristicLabUser.UserName == username) > 0); 111 } 112 context.Dispose(); 113 return returnValue; 117 114 } 118 115
Note: See TracChangeset
for help on using the changeset viewer.