Skip to content

Commit 8ddb911

Browse files
authored
V14; Refactor permissions for Document/Media/Member (#16310)
* Refactor permissions * Fix user startnode caching * Relax permissions on user item endpoint * Refactor media types to align with newly refactored content permissions * Remove permissions from member type item endpoint
1 parent b56d143 commit 8ddb911

22 files changed

+44
-21
lines changed

src/Umbraco.Cms.Api.Management/Controllers/DocumentType/AllowedAtRootDocumentTypeController.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Umbraco.Cms.Api.Management.Controllers.DocumentType;
1313

1414
[ApiVersion("1.0")]
15-
[Authorize(Policy = AuthorizationPolicies.TreeAccessDocumentsOrDocumentTypes)]
1615
public class AllowedAtRootDocumentTypeController : DocumentTypeControllerBase
1716
{
1817
private readonly IContentTypeService _contentTypeService;

src/Umbraco.Cms.Api.Management/Controllers/DocumentType/AllowedChildrenDocumentTypeController.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
namespace Umbraco.Cms.Api.Management.Controllers.DocumentType;
1515

1616
[ApiVersion("1.0")]
17-
[Authorize(Policy = AuthorizationPolicies.TreeAccessDocumentsOrDocumentTypes)]
1817
public class AllowedChildrenDocumentTypeController : DocumentTypeControllerBase
1918
{
2019
private readonly IContentTypeService _contentTypeService;

src/Umbraco.Cms.Api.Management/Controllers/DocumentType/AvailableCompositionDocumentTypeController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
using Asp.Versioning;
2+
using Microsoft.AspNetCore.Authorization;
23
using Microsoft.AspNetCore.Http;
34
using Microsoft.AspNetCore.Mvc;
45
using Umbraco.Cms.Api.Management.Factories;
56
using Umbraco.Cms.Api.Management.ViewModels.DocumentType;
67
using Umbraco.Cms.Core.Models;
78
using Umbraco.Cms.Core.Services.ContentTypeEditing;
9+
using Umbraco.Cms.Web.Common.Authorization;
810

911
namespace Umbraco.Cms.Api.Management.Controllers.DocumentType;
1012

1113
[ApiVersion("1.0")]
14+
[Authorize(Policy = AuthorizationPolicies.TreeAccessDocumentTypes)]
1215
public class AvailableCompositionDocumentTypeController : DocumentTypeControllerBase
1316
{
1417
private readonly IContentTypeEditingService _contentTypeEditingService;

src/Umbraco.Cms.Api.Management/Controllers/DocumentType/CompositionReferenceDocumentTypeController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
using Asp.Versioning;
2+
using Microsoft.AspNetCore.Authorization;
23
using Microsoft.AspNetCore.Http;
34
using Microsoft.AspNetCore.Mvc;
45
using Umbraco.Cms.Api.Management.ViewModels.DocumentType;
56
using Umbraco.Cms.Core.Mapping;
67
using Umbraco.Cms.Core.Models;
78
using Umbraco.Cms.Core.Services;
89
using Umbraco.Cms.Core.Services.OperationStatus;
10+
using Umbraco.Cms.Web.Common.Authorization;
911

1012
namespace Umbraco.Cms.Api.Management.Controllers.DocumentType;
1113

1214
[ApiVersion("1.0")]
15+
[Authorize(Policy = AuthorizationPolicies.TreeAccessDocumentTypes)]
1316
public class CompositionReferenceDocumentTypeController : DocumentTypeControllerBase
1417
{
1518
private readonly IContentTypeService _contentTypeService;

src/Umbraco.Cms.Api.Management/Controllers/DocumentType/ConfigurationDocumentTypeController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
using Asp.Versioning;
2+
using Microsoft.AspNetCore.Authorization;
23
using Microsoft.AspNetCore.Http;
34
using Microsoft.AspNetCore.Mvc;
45
using Microsoft.Extensions.Options;
56
using Umbraco.Cms.Api.Management.ViewModels.DocumentType;
67
using Umbraco.Cms.Core.Configuration.Models;
78
using Umbraco.Cms.Core.Features;
9+
using Umbraco.Cms.Web.Common.Authorization;
810

911
namespace Umbraco.Cms.Api.Management.Controllers.DocumentType;
1012

1113
[ApiVersion("1.0")]
14+
[Authorize(Policy = AuthorizationPolicies.TreeAccessDocumentTypes)]
1215
public class ConfigurationDocumentTypeController : DocumentTypeControllerBase
1316
{
1417
private readonly UmbracoFeatures _umbracoFeatures;

src/Umbraco.Cms.Api.Management/Controllers/DocumentType/CopyDocumentTypeController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
using Asp.Versioning;
2+
using Microsoft.AspNetCore.Authorization;
23
using Microsoft.AspNetCore.Http;
34
using Microsoft.AspNetCore.Mvc;
45
using Umbraco.Cms.Api.Management.ViewModels.DocumentType;
56
using Umbraco.Cms.Core;
67
using Umbraco.Cms.Core.Models;
78
using Umbraco.Cms.Core.Services;
89
using Umbraco.Cms.Core.Services.OperationStatus;
10+
using Umbraco.Cms.Web.Common.Authorization;
911

1012
namespace Umbraco.Cms.Api.Management.Controllers.DocumentType;
1113

1214
[ApiVersion("1.0")]
15+
[Authorize(Policy = AuthorizationPolicies.TreeAccessDocumentTypes)]
1316
public class CopyDocumentTypeController : DocumentTypeControllerBase
1417
{
1518
private readonly IContentTypeService _contentTypeService;

src/Umbraco.Cms.Api.Management/Controllers/DocumentType/CreateDocumentTypeController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Asp.Versioning;
2+
using Microsoft.AspNetCore.Authorization;
23
using Microsoft.AspNetCore.Http;
34
using Microsoft.AspNetCore.Mvc;
45
using Umbraco.Cms.Api.Management.Factories;
@@ -9,10 +10,12 @@
910
using Umbraco.Cms.Core.Security;
1011
using Umbraco.Cms.Core.Services.ContentTypeEditing;
1112
using Umbraco.Cms.Core.Services.OperationStatus;
13+
using Umbraco.Cms.Web.Common.Authorization;
1214

1315
namespace Umbraco.Cms.Api.Management.Controllers.DocumentType;
1416

1517
[ApiVersion("1.0")]
18+
[Authorize(Policy = AuthorizationPolicies.TreeAccessDocumentTypes)]
1619
public class CreateDocumentTypeController : DocumentTypeControllerBase
1720
{
1821
private readonly IDocumentTypeEditingPresentationFactory _documentTypeEditingPresentationFactory;

src/Umbraco.Cms.Api.Management/Controllers/DocumentType/DeleteDocumentTypeController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
using Asp.Versioning;
2+
using Microsoft.AspNetCore.Authorization;
23
using Microsoft.AspNetCore.Http;
34
using Microsoft.AspNetCore.Mvc;
45
using Umbraco.Cms.Api.Management.ViewModels.DocumentType;
56
using Umbraco.Cms.Core.Security;
67
using Umbraco.Cms.Core.Services;
78
using Umbraco.Cms.Core.Services.OperationStatus;
9+
using Umbraco.Cms.Web.Common.Authorization;
810

911
namespace Umbraco.Cms.Api.Management.Controllers.DocumentType;
1012

1113
[ApiVersion("1.0")]
14+
[Authorize(Policy = AuthorizationPolicies.TreeAccessDocumentTypes)]
1215
public class DeleteDocumentTypeController : DocumentTypeControllerBase
1316
{
1417
private readonly IContentTypeService _contentTypeService;

src/Umbraco.Cms.Api.Management/Controllers/DocumentType/DocumentTypeControllerBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Umbraco.Cms.Api.Management.Controllers.DocumentType;
1111

1212
[VersionedApiBackOfficeRoute(Constants.UdiEntityType.DocumentType)]
1313
[ApiExplorerSettings(GroupName = "Document Type")]
14-
[Authorize(Policy = AuthorizationPolicies.TreeAccessDocumentTypes)]
14+
[Authorize(Policy = AuthorizationPolicies.TreeAccessDocumentsOrDocumentTypes)]
1515
public abstract class DocumentTypeControllerBase : ManagementApiControllerBase
1616
{
1717
protected IActionResult OperationStatusResult(ContentTypeOperationStatus status)

src/Umbraco.Cms.Api.Management/Controllers/DocumentType/MoveDocumentTypeController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
using Asp.Versioning;
2+
using Microsoft.AspNetCore.Authorization;
23
using Microsoft.AspNetCore.Http;
34
using Microsoft.AspNetCore.Mvc;
45
using Umbraco.Cms.Api.Management.ViewModels.DocumentType;
56
using Umbraco.Cms.Core;
67
using Umbraco.Cms.Core.Models;
78
using Umbraco.Cms.Core.Services;
89
using Umbraco.Cms.Core.Services.OperationStatus;
10+
using Umbraco.Cms.Web.Common.Authorization;
911

1012
namespace Umbraco.Cms.Api.Management.Controllers.DocumentType;
1113

1214
[ApiVersion("1.0")]
15+
[Authorize(Policy = AuthorizationPolicies.TreeAccessDocumentTypes)]
1316
public class MoveDocumentTypeController : DocumentTypeControllerBase
1417
{
1518
private readonly IContentTypeService _contentTypeService;

0 commit comments

Comments
 (0)