-
Notifications
You must be signed in to change notification settings - Fork 748
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5841 from GerardSmit/feature/permission-service
Add IPermissionService for Abstractions Project
- Loading branch information
Showing
18 changed files
with
599 additions
and
289 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
DNN Platform/DotNetNuke.Abstractions/Security/Permissions/IFolderPermissionInfo.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,21 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace DotNetNuke.Abstractions.Security.Permissions; | ||
|
||
/// <summary>Information about the application of an instance of a folder permission.</summary> | ||
public interface IFolderPermissionInfo : IPermissionInfo | ||
{ | ||
/// <summary>Gets or sets the ID of the folder permission.</summary> | ||
int FolderPermissionId { get; set; } | ||
|
||
/// <summary>Gets or sets the folder ID to which the permission applies.</summary> | ||
int FolderId { get; set; } | ||
|
||
/// <summary>Gets or sets the path of the folder to which the permission applies.</summary> | ||
string FolderPath { get; set; } | ||
|
||
/// <summary>Gets or sets the portal ID of the folder to which the permission applies.</summary> | ||
int PortalId { get; set; } | ||
} |
24 changes: 24 additions & 0 deletions
24
DNN Platform/DotNetNuke.Abstractions/Security/Permissions/IPermissionDefinitionInfo.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,24 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace DotNetNuke.Abstractions.Security.Permissions; | ||
|
||
/// <summary>Information about the definition of a permission.</summary> | ||
public interface IPermissionDefinitionInfo | ||
{ | ||
/// <summary>Gets or sets the Module Definition ID.</summary> | ||
public int ModuleDefId { get; set; } | ||
|
||
/// <summary>Gets or sets the Permission Code.</summary> | ||
public string PermissionCode { get; set; } | ||
|
||
/// <summary>Gets or sets the Permission ID.</summary> | ||
public int PermissionId { get; set; } | ||
|
||
/// <summary>Gets or sets the Permission Key.</summary> | ||
public string PermissionKey { get; set; } | ||
|
||
/// <summary>Gets or sets the Permission Name.</summary> | ||
public string PermissionName { get; set; } | ||
} |
69 changes: 69 additions & 0 deletions
69
DNN Platform/DotNetNuke.Abstractions/Security/Permissions/IPermissionDefinitionService.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,69 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace DotNetNuke.Abstractions.Security.Permissions; | ||
|
||
using System.Collections.Generic; | ||
|
||
/// <summary>Handles the Business Control Layer for Permissions.</summary> | ||
public interface IPermissionDefinitionService | ||
{ | ||
/// <summary>Gets the permissions.</summary> | ||
/// <returns>The permissions.</returns> | ||
IEnumerable<IPermissionDefinitionInfo> GetDefinitions(); | ||
|
||
/// <summary>Gets the permissions by folder.</summary> | ||
/// <returns>The permissions by folder.</returns> | ||
IEnumerable<IPermissionDefinitionInfo> GetDefinitionsByFolder(); | ||
|
||
/// <summary>Gets the permissions by desktop module.</summary> | ||
/// <returns>The permissions by desktop module.</returns> | ||
IEnumerable<IPermissionDefinitionInfo> GetDefinitionsByPortalDesktopModule(); | ||
|
||
/// <summary>Gets the permissions by tab.</summary> | ||
/// <returns>The permissions by tab.</returns> | ||
IEnumerable<IPermissionDefinitionInfo> GetDefinitionsByTab(); | ||
|
||
/// <summary>Gets the permissions by <see cref="IPermissionDefinitionInfo.PermissionCode"/> and <see cref="IPermissionDefinitionInfo.PermissionKey"/>.</summary> | ||
/// <param name="permissionCode">The permission code.</param> | ||
/// <param name="permissionKey">The permission key.</param> | ||
/// <returns>The permissions by tab.</returns> | ||
IEnumerable<IPermissionDefinitionInfo> GetDefinitionsByCodeAndKey(string permissionCode, string permissionKey); | ||
|
||
/// <summary>Gets the permissions by <see cref="IPermissionDefinitionInfo.ModuleDefId"/>.</summary> | ||
/// <param name="moduleDefId">The module definition ID.</param> | ||
/// <returns>The permissions by tab.</returns> | ||
IEnumerable<IPermissionDefinitionInfo> GetDefinitionsByModuleDefId(int moduleDefId); | ||
|
||
/// <summary>Gets the permissions by <see cref="IPermissionDefinitionInfo.ModuleDefId"/> and <see cref="IPermissionDefinitionInfo.PermissionCode"/> for the given module in the tab.</summary> | ||
/// <param name="moduleId">The module ID.</param> | ||
/// <param name="tabId">The tab ID.</param> | ||
/// <returns>The permissions by tab.</returns> | ||
IEnumerable<IPermissionDefinitionInfo> GetDefinitionsByModule(int moduleId, int tabId); | ||
|
||
/// <summary>Adds a new permission.</summary> | ||
/// <param name="permissionDefinition">The permission.</param> | ||
/// <returns>The new permission ID.</returns> | ||
int AddDefinition(IPermissionDefinitionInfo permissionDefinition); | ||
|
||
/// <summary>Deletes an existing permission.</summary> | ||
/// <param name="permissionDefinition">The permission to delete.</param> | ||
void DeleteDefinition(IPermissionDefinitionInfo permissionDefinition); | ||
|
||
/// <summary>Gets the permission by the <see cref="IPermissionDefinitionInfo.PermissionId"/>.</summary> | ||
/// <param name="permissionDefinitionId">The permission ID.</param> | ||
/// <returns>The permission.</returns> | ||
IPermissionDefinitionInfo GetDefinition(int permissionDefinitionId); | ||
|
||
/// <summary>Updates an existing permission.</summary> | ||
/// <param name="permission">The permission.</param> | ||
void UpdateDefinition(IPermissionDefinitionInfo permission); | ||
|
||
/// <summary>Clears the permission definition cache.</summary> | ||
/// <remarks> | ||
/// <see cref="AddDefinition"/>, <see cref="UpdateDefinition"/> and <see cref="DeleteDefinition"/> will clear the cache automatically. | ||
/// This method is only needed if you want to clear the cache manually. | ||
/// </remarks> | ||
void ClearCache(); | ||
} |
27 changes: 27 additions & 0 deletions
27
DNN Platform/DotNetNuke.Abstractions/Security/Permissions/IPermissionInfo.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,27 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace DotNetNuke.Abstractions.Security.Permissions; | ||
|
||
/// <summary>Information about an applied instance of a permission.</summary> | ||
public interface IPermissionInfo : IPermissionDefinitionInfo | ||
{ | ||
/// <summary>Gets or sets a value indicating whether gets and sets a flag that indicates whether the user or role has permission.</summary> | ||
bool AllowAccess { get; set; } | ||
|
||
/// <summary>Gets or sets the User's DisplayName.</summary> | ||
string DisplayName { get; set; } | ||
|
||
/// <summary>Gets or sets the Role ID.</summary> | ||
int RoleId { get; set; } | ||
|
||
/// <summary>Gets or sets the Role Name.</summary> | ||
string RoleName { get; set; } | ||
|
||
/// <summary>Gets or sets the User ID.</summary> | ||
int UserId { get; set; } | ||
|
||
/// <summary>Gets or sets the User Name.</summary> | ||
string Username { 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
Oops, something went wrong.