Skip to content
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

26 lines (24 sloc) 848 Bytes
using System.Collections.Generic;
using System.Linq;
using FeatureAuthorize;
using Microsoft.AspNetCore.Mvc;
using PermissionParts;
namespace PermissionAccessControl2.Controllers
public class FrontEndController : ControllerBase
/// <summary>
/// This returns null (HTTP 204 - no content) if no logged in user, otherwise a array of the logged in user's permissions
/// </summary>
/// <returns></returns>
public IEnumerable<string> Get()
var packedPermissions = HttpContext.User?.Claims
.SingleOrDefault(x => x.Type == PermissionConstants.PackedPermissionClaimType);
return packedPermissions?.Value.UnpackPermissionsFromString().Select(x => x.ToString());
You can’t perform that action at this time.