Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add verification for local clone #14793

Merged
merged 2 commits into from
Feb 25, 2025
Merged
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 @@ -5,6 +5,7 @@
using Altinn.Studio.Designer.Helpers;
using Altinn.Studio.Designer.Models;
using Altinn.Studio.Designer.Models.Dto;
using Altinn.Studio.Designer.Services.Interfaces;
using Altinn.Studio.Designer.Services.Interfaces.Organisation;
using LibGit2Sharp;
using Microsoft.AspNetCore.Authorization;
Expand All @@ -22,14 +23,17 @@ namespace Altinn.Studio.Designer.Controllers.Organisation;
public class OrgCodeListController : ControllerBase
{
private readonly IOrgCodeListService _orgCodeListService;
private readonly ISourceControl _sourceControl;

/// <summary>
/// Initializes a new instance of the <see cref="OrgCodeListController"/> class.
/// </summary>
/// <param name="orgCodeListService">The CodeList service for organisation level</param>
public OrgCodeListController(IOrgCodeListService orgCodeListService)
/// <param name="sourceControl">The source control service.</param>
public OrgCodeListController(IOrgCodeListService orgCodeListService, ISourceControl sourceControl)
{
_orgCodeListService = orgCodeListService;
_sourceControl = sourceControl;
}

/// <summary>
Expand All @@ -44,6 +48,7 @@ public async Task<ActionResult<List<OptionListData>>> GetCodeLists(string org, C
{
try
{
await _sourceControl.VerifyCloneExists(org, $"{org}-content");
string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext);

List<OptionListData> codeLists = await _orgCodeListService.GetCodeLists(org, developer, cancellationToken);
Expand Down