Skip to content

Commit

Permalink
Loosen up policies so editors can get what they need
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeegaan authored and bergmania committed Dec 12, 2023
1 parent 0c355b0 commit 73fab10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/Umbraco.Web.BackOffice/Controllers/LanguageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers;
/// Backoffice controller supporting the dashboard for language administration.
/// </summary>
[PluginController(Constants.Web.Mvc.BackOfficeApiArea)]
[Authorize(Policy = AuthorizationPolicies.SectionAccessSettings)]
public class LanguageController : UmbracoAuthorizedJsonController
{
private readonly ILocalizationService _localizationService;
Expand All @@ -36,14 +35,15 @@ public LanguageController(ILocalizationService localizationService, IUmbracoMapp
/// </summary>
/// <returns></returns>
[HttpGet]
public IDictionary<string, string> GetAllCultures()
[Authorize(Policy = AuthorizationPolicies.TreeAccessLanguages)]public IDictionary<string, string> GetAllCultures()
=> CultureInfo.GetCultures(CultureTypes.AllCultures).DistinctBy(x => x.Name).OrderBy(x => x.EnglishName).ToDictionary(x => x.Name, x => x.EnglishName);

/// <summary>
/// Returns all currently configured languages.
/// </summary>
/// <returns></returns>
[HttpGet]
[Authorize(Policy = AuthorizationPolicies.SectionAccessContent)]
public IEnumerable<Language>? GetAllLanguages()
{
IEnumerable<ILanguage> allLanguages = _localizationService.GetAllLanguages();
Expand All @@ -52,6 +52,7 @@ public LanguageController(ILocalizationService localizationService, IUmbracoMapp
}

[HttpGet]
[Authorize(Policy = AuthorizationPolicies.TreeAccessLanguages)]
public ActionResult<Language?> GetLanguage(int id)
{
ILanguage? lang = _localizationService.GetLanguageById(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers;
/// The API controller used for retrieving available stylesheets
/// </summary>
[PluginController(Constants.Web.Mvc.BackOfficeApiArea)]
[Authorize(Policy = AuthorizationPolicies.SectionAccessSettings)]
[Authorize(Policy = AuthorizationPolicies.SectionAccessContent)]
public class StylesheetController : UmbracoAuthorizedJsonController
{
private readonly IFileService _fileService;
Expand Down

0 comments on commit 73fab10

Please sign in to comment.