Skip to content

Commit 5fd814c

Browse files
committed
TD-4169 Corrected wrong AdminID in FrameworkCollaborators Table
1 parent b1438be commit 5fd814c

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ bool zeroBased
130130

131131
int InsertFrameworkCompetency(int competencyId, int? frameworkCompetencyGroupID, int adminId, int frameworkId);
132132

133-
int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify);
133+
int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify, int? centreID);
134134
void AddCustomFlagToFramework(int frameworkId, string flagName, string flagGroup, string flagTagClass);
135135
void UpdateFrameworkCustomFlag(int frameworkId, int id, string flagName, string flagGroup, string flagTagClass);
136136

@@ -751,7 +751,7 @@ FROM FrameworkCollaborators fc
751751
);
752752
}
753753

754-
public int AddCollaboratorToFramework(int frameworkId, string? userEmail, bool canModify)
754+
public int AddCollaboratorToFramework(int frameworkId, string? userEmail, bool canModify, int? centreID)
755755
{
756756
if (userEmail is null || userEmail.Length == 0)
757757
{
@@ -774,8 +774,8 @@ FROM FrameworkCollaborators
774774
}
775775

776776
var adminId = (int?)connection.ExecuteScalar(
777-
@"SELECT AdminID FROM AdminUsers WHERE Email = @userEmail AND Active = 1",
778-
new { userEmail }
777+
@"SELECT AdminID FROM AdminUsers WHERE Email = @userEmail AND Active = 1 AND CentreID = @centreID",
778+
new { userEmail, centreID }
779779
);
780780
if (adminId is null)
781781
{

DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,8 @@ public IActionResult AddCollaborators(string actionname, int frameworkId, bool e
641641
[Route("/Frameworks/Collaborators/{actionname}/{frameworkId}/")]
642642
public IActionResult AddCollaborator(string actionname, string userEmail, bool canModify, int frameworkId)
643643
{
644-
var collaboratorId = frameworkService.AddCollaboratorToFramework(frameworkId, userEmail, canModify);
644+
int? centreID = GetCentreId();
645+
var collaboratorId = frameworkService.AddCollaboratorToFramework(frameworkId, userEmail, canModify, centreID);
645646
if (collaboratorId > 0)
646647
{
647648
frameworkNotificationService.SendFrameworkCollaboratorInvite(collaboratorId, GetAdminId());

DigitalLearningSolutions.Web/Services/FrameworkService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ bool zeroBased
124124

125125
int InsertFrameworkCompetency(int competencyId, int? frameworkCompetencyGroupID, int adminId, int frameworkId);
126126

127-
int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify);
127+
int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify, int? centreID);
128128
void AddCustomFlagToFramework(int frameworkId, string flagName, string flagGroup, string flagTagClass);
129129
void UpdateFrameworkCustomFlag(int frameworkId, int id, string flagName, string flagGroup, string flagTagClass);
130130

@@ -264,9 +264,9 @@ public FrameworkService(IFrameworkDataService frameworkDataService)
264264
this.frameworkDataService = frameworkDataService;
265265
}
266266

267-
public int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify)
267+
public int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify, int? centreID)
268268
{
269-
return frameworkDataService.AddCollaboratorToFramework(frameworkId, userEmail, canModify);
269+
return frameworkDataService.AddCollaboratorToFramework(frameworkId, userEmail, canModify, centreID);
270270
}
271271

272272
public void AddCompetencyAssessmentQuestion(int frameworkCompetencyId, int assessmentQuestionId, int adminId)

0 commit comments

Comments
 (0)