-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/13686-support-access-packages-in-policy…
…-editor-v1
- Loading branch information
Showing
399 changed files
with
8,402 additions
and
4,760 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
725 changes: 367 additions & 358 deletions
725
.yarn/releases/yarn-4.5.0.cjs → .yarn/releases/yarn-4.5.1.cjs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
backend/src/Designer/Configuration/FeedbackFormSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Altinn.Studio.Designer.Configuration.Marker; | ||
|
||
namespace Altinn.Studio.Designer.Configuration | ||
{ | ||
/// <summary> | ||
/// Class representation for basic FeedbackForm configuration | ||
/// </summary> | ||
public class FeedbackFormSettings : ISettingsMarker | ||
{ | ||
/// <summary> | ||
/// Gets or sets the Slack settings | ||
/// </summary> | ||
public SlackSettings SlackSettings { get; set; } | ||
} | ||
|
||
public class SlackSettings | ||
{ | ||
/// <summary> | ||
/// Gets or sets the WebhookUrl | ||
/// </summary> | ||
public string WebhookUrl { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Altinn.Studio.Designer.Configuration.Marker; | ||
|
||
namespace Altinn.Studio.Designer.Configuration; | ||
|
||
public class RedisCacheSettings : ISettingsMarker | ||
{ | ||
public bool UseRedisCache { get; set; } = false; | ||
public string ConnectionString { get; set; } | ||
public string InstanceName { get; set; } | ||
} |
45 changes: 45 additions & 0 deletions
45
backend/src/Designer/Controllers/AnsattPortenController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Threading.Tasks; | ||
using Altinn.Studio.Designer.Constants; | ||
using Altinn.Studio.Designer.Models.Dto; | ||
using Microsoft.AspNetCore.Authentication; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.FeatureManagement.Mvc; | ||
|
||
namespace Altinn.Studio.Designer.Controllers; | ||
|
||
[FeatureGate(StudioFeatureFlags.AnsattPorten)] | ||
[Route("designer/api/[controller]")] | ||
[ApiController] | ||
public class AnsattPortenController : ControllerBase | ||
{ | ||
[Authorize(AnsattPortenConstants.AnsattportenAuthorizationPolicy)] | ||
[HttpGet("login")] | ||
public async Task<IActionResult> Login([FromQuery(Name = "redirect_to")] string redirectTo) | ||
{ | ||
await Task.CompletedTask; | ||
if (!Url.IsLocalUrl(redirectTo)) | ||
{ | ||
return Forbid(); | ||
} | ||
|
||
return LocalRedirect(redirectTo); | ||
} | ||
|
||
[AllowAnonymous] | ||
[HttpGet("auth-status")] | ||
public async Task<IActionResult> AuthStatus() | ||
{ | ||
await Task.CompletedTask; | ||
var authenticateResult = | ||
await HttpContext.AuthenticateAsync(AnsattPortenConstants.AnsattportenAuthenticationScheme); | ||
|
||
var authStatus = new AuthStatus | ||
{ | ||
IsLoggedIn = authenticateResult.Succeeded | ||
}; | ||
|
||
return Ok(authStatus); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
backend/src/Designer/Controllers/FeedbackFormController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
using System.Text.Json; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Altinn.Studio.Designer.Configuration; | ||
using Altinn.Studio.Designer.Models.Dto; | ||
using Altinn.Studio.Designer.TypedHttpClients.Slack; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Routing; | ||
|
||
namespace Altinn.Studio.Designer.Controllers; | ||
|
||
/// <summary> | ||
/// Controller containing actions related to feedback form | ||
/// </summary> | ||
[Authorize] | ||
[ApiController] | ||
[ValidateAntiForgeryToken] | ||
[Route("designer/api/{org}/{app:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}/feedbackform")] | ||
public class FeedbackFormController : ControllerBase | ||
{ | ||
private readonly ISlackClient _slackClient; | ||
private readonly GeneralSettings _generalSettings; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="FeedbackFormController"/> class. | ||
/// </summary> | ||
/// <param name="slackClient">A http client to send messages to slack</param> | ||
/// <param name="generalSettings">the general settings</param> | ||
public FeedbackFormController(ISlackClient slackClient, GeneralSettings generalSettings) | ||
{ | ||
_slackClient = slackClient; | ||
_generalSettings = generalSettings; | ||
} | ||
|
||
/// <summary> | ||
/// Endpoint for submitting feedback | ||
/// </summary> | ||
[HttpPost] | ||
[Route("submit")] | ||
public async Task<IActionResult> SubmitFeedback([FromRoute] string org, [FromRoute] string app, [FromBody] FeedbackForm feedback, CancellationToken cancellationToken) | ||
{ | ||
if (feedback == null) | ||
{ | ||
return BadRequest("Feedback object is null"); | ||
} | ||
|
||
if (feedback.Answers == null || feedback.Answers.Count == 0) | ||
{ | ||
return BadRequest("Feedback answers are null or empty"); | ||
} | ||
|
||
if (!feedback.Answers.ContainsKey("org")) | ||
{ | ||
feedback.Answers.Add("org", org); | ||
} | ||
|
||
if (!feedback.Answers.ContainsKey("app")) | ||
{ | ||
feedback.Answers.Add("app", app); | ||
} | ||
|
||
if (!feedback.Answers.ContainsKey("env")) | ||
{ | ||
feedback.Answers.Add("env", _generalSettings.HostName); | ||
} | ||
|
||
await _slackClient.SendMessage(new SlackRequest | ||
{ | ||
Text = JsonSerializer.Serialize(feedback.Answers, new JsonSerializerOptions { WriteIndented = true }) | ||
}, cancellationToken); | ||
|
||
return Ok(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.