Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ bool zeroBased

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

int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify);
int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify, int? centreID);
void AddCustomFlagToFramework(int frameworkId, string flagName, string flagGroup, string flagTagClass);
void UpdateFrameworkCustomFlag(int frameworkId, int id, string flagName, string flagGroup, string flagTagClass);

Expand Down Expand Up @@ -751,7 +751,7 @@ FROM FrameworkCollaborators fc
);
}

public int AddCollaboratorToFramework(int frameworkId, string? userEmail, bool canModify)
public int AddCollaboratorToFramework(int frameworkId, string? userEmail, bool canModify, int? centreID)
{
if (userEmail is null || userEmail.Length == 0)
{
Expand All @@ -774,8 +774,8 @@ FROM FrameworkCollaborators
}

var adminId = (int?)connection.ExecuteScalar(
@"SELECT AdminID FROM AdminUsers WHERE Email = @userEmail AND Active = 1",
new { userEmail }
@"SELECT AdminID FROM AdminUsers WHERE Email = @userEmail AND Active = 1 AND CentreID = @centreID",
new { userEmail, centreID }
);
if (adminId is null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public IActionResult CreateNewFramework(string actionname, int frameworkId = 0)
var sessionNewFramework = multiPageFormService.GetMultiPageFormData<SessionNewFramework>(
MultiPageFormDataFeature.AddNewFramework,
TempData
).GetAwaiter().GetResult();
).GetAwaiter().GetResult();
multiPageFormService.SetMultiPageFormData(sessionNewFramework, MultiPageFormDataFeature.AddNewFramework, TempData);
detailFramework = sessionNewFramework.DetailFramework;
}
Expand Down Expand Up @@ -252,7 +252,7 @@ public IActionResult SaveNewFramework(string frameworkname, string actionname)
{
return StatusCode(500);
}
var sessionNewFramework = multiPageFormService.GetMultiPageFormData<SessionNewFramework>(MultiPageFormDataFeature.AddNewFramework, TempData).GetAwaiter().GetResult();
var sessionNewFramework = multiPageFormService.GetMultiPageFormData<SessionNewFramework>(MultiPageFormDataFeature.AddNewFramework, TempData).GetAwaiter().GetResult();
multiPageFormService.SetMultiPageFormData(
sessionNewFramework,
MultiPageFormDataFeature.AddNewFramework,
Expand Down Expand Up @@ -641,7 +641,8 @@ public IActionResult AddCollaborators(string actionname, int frameworkId, bool e
[Route("/Frameworks/Collaborators/{actionname}/{frameworkId}/")]
public IActionResult AddCollaborator(string actionname, string userEmail, bool canModify, int frameworkId)
{
var collaboratorId = frameworkService.AddCollaboratorToFramework(frameworkId, userEmail, canModify);
int? centreID = GetCentreId();
var collaboratorId = frameworkService.AddCollaboratorToFramework(frameworkId, userEmail, canModify, centreID);
if (collaboratorId > 0)
{
frameworkNotificationService.SendFrameworkCollaboratorInvite(collaboratorId, GetAdminId());
Expand Down
6 changes: 3 additions & 3 deletions DigitalLearningSolutions.Web/Services/FrameworkService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ bool zeroBased

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

int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify);
int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify, int? centreID);
void AddCustomFlagToFramework(int frameworkId, string flagName, string flagGroup, string flagTagClass);
void UpdateFrameworkCustomFlag(int frameworkId, int id, string flagName, string flagGroup, string flagTagClass);

Expand Down Expand Up @@ -264,9 +264,9 @@ public FrameworkService(IFrameworkDataService frameworkDataService)
this.frameworkDataService = frameworkDataService;
}

public int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify)
public int AddCollaboratorToFramework(int frameworkId, string userEmail, bool canModify, int? centreID)
{
return frameworkDataService.AddCollaboratorToFramework(frameworkId, userEmail, canModify);
return frameworkDataService.AddCollaboratorToFramework(frameworkId, userEmail, canModify, centreID);
}

public void AddCompetencyAssessmentQuestion(int frameworkCompetencyId, int assessmentQuestionId, int adminId)
Expand Down
Loading