Skip to content

Commit

Permalink
VCST-889: The company User does not have permissions for file upload (#3
Browse files Browse the repository at this point in the history
)

fix: The company User does not have permissions for file upload
  • Loading branch information
OlegoO committed Apr 9, 2024
1 parent fc5f434 commit fc8221a
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -3,7 +3,6 @@
using System.IO;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -23,8 +22,8 @@

namespace VirtoCommerce.FileExperienceApi.Web.Controllers;

// Don't add Authorize Attribute. Authorize Attribute activates the option that blocks Rest API requests for Customer accounts.
[Route("api/files")]
[Authorize]
public class FileUploadController : Controller
{
private readonly SignInManager<ApplicationUser> _signInManager;
Expand Down Expand Up @@ -155,11 +154,12 @@ public async Task<ActionResult> DownloadFile([FromRoute] string id)
}


// Temporary workaround for requests from the storefront. Delete after getting rid of the storefront.

private async Task<ClaimsPrincipal> GetCurrentUser()
{
var principal = User;

// Temporary workaround for requests from the storefront. Delete after getting rid of the storefront.
if (Request.Headers.TryGetValue("VirtoCommerce-User-Name", out var userNameFromHeader) &&
principal.IsInRole(PlatformConstants.Security.SystemRoles.Administrator))
{
Expand Down

0 comments on commit fc8221a

Please sign in to comment.