Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merges latest fixes from develop into release/10.0.0 #6088

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4328c06
Bump less-loader from 4.1.0 to 12.2.0
dependabot[bot] Feb 1, 2024
b71174b
Bump Moq from 4.18.4 to 4.20.70
dependabot[bot] Feb 1, 2024
8fbf4d1
Bump LiteDB from 5.0.13 to 5.0.19
dependabot[bot] May 1, 2024
176fe14
Fix resource manager permissions save issues
Aideforth May 22, 2024
fc1076c
Update procedure GetFolderPermissionsByPortalAndPath to lookup null v…
Aideforth Jun 2, 2024
4c221c2
Update Cake-Issues Dependabot group
bdukes Jun 3, 2024
3969165
Bump the npm_and_yarn group with 2 updates
dependabot[bot] Jun 18, 2024
c591528
Update build.ps1
tututu-patch Jun 20, 2024
1e9736a
Update build.sh
tututu-patch Jun 20, 2024
96738ce
Rename Sql Provider file
Aideforth Jun 20, 2024
5043003
Update csproj file with the sql data provider file also
Aideforth Jun 20, 2024
d6c6965
Add sorting functionality to recycle bin items
Jun 21, 2024
080bae1
Fixes issue #6074
Jun 21, 2024
03f04a4
Merge pull request #6078 from ufoloko/ShowCorrectDeletedDateRecycleBin
david-poindexter Jun 21, 2024
ef35d03
Merge pull request #6079 from ufoloko/SortRecycleBinElements
david-poindexter Jun 21, 2024
30d7166
Merge branch 'develop' into bugfix/resource-manager-permissions-save-fix
valadas Jun 22, 2024
50bd25f
Merge pull request #6046 from Adeoluwa-Simeon/bugfix/resource-manager…
valadas Jun 22, 2024
63dc285
Merge pull request #5948 from dnnsoftware/dependabot/nuget/Moq-4.20.70
valadas Jun 22, 2024
a53960e
Merge pull request #6076 from tututu-patch/develop
david-poindexter Jun 23, 2024
eff40d8
Merge pull request #6022 from dnnsoftware/dependabot/nuget/LiteDB-5.0.19
david-poindexter Jun 23, 2024
d9ac96e
Merge pull request #6073 from dnnsoftware/dependabot/npm_and_yarn/npm…
valadas Jun 24, 2024
05da30e
Merge pull request #5951 from dnnsoftware/dependabot/npm_and_yarn/les…
valadas Jun 24, 2024
00b3ffe
Merge pull request #6066 from bdukes/develop
david-poindexter Jun 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ updates:
Cake-Issues:
patterns:
- "Cake.Issues*"
- "Cake.Frosting.Issues*"
DependencyInjection:
patterns:
- "Microsoft.Extensions.DependencyInjection*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
<WarningsNotAsErrors>CS0618,SA1600</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="LiteDB, Version=5.0.13.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\LiteDB.5.0.13\lib\net45\LiteDB.dll</HintPath>
<Reference Include="LiteDB, Version=5.0.19.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27">
<HintPath>..\..\..\packages\LiteDB.5.0.19\lib\net45\LiteDB.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LiteDB" version="5.0.13" targetFramework="net472" />
<package id="LiteDB" version="5.0.19" targetFramework="net472" />
<package id="Microsoft.Build.Tasks.Git" version="8.0.0" targetFramework="net472" developmentDependency="true" />
<package id="Microsoft.SourceLink.Common" version="8.0.0" targetFramework="net472" developmentDependency="true" />
<package id="Microsoft.SourceLink.GitHub" version="8.0.0" targetFramework="net472" developmentDependency="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IRole } from '@dnncommunity/dnn-elements/dist/types/components/dnn-perm
import { Component, Element, Event, EventEmitter, Host, h, State, Prop } from '@stencil/core';
import state from '../../store/store';
import { FolderDetails, ItemsClient, SaveFolderDetailsRequest } from '../../services/ItemsClient';
import { IPermissions, IRolePermission, IUserPermission } from '@dnncommunity/dnn-elements/dist/types/components/dnn-permissions-grid/permissions-interface';
import { IPermissionDefinition, IPermissions, IRolePermission, IUserPermission } from '@dnncommunity/dnn-elements/dist/types/components/dnn-permissions-grid/permissions-interface';
import { ISearchedUser } from '@dnncommunity/dnn-elements/dist/types/components/dnn-permissions-grid/searched-user-interface';
@Component({
tag: 'dnn-rm-edit-folder',
Expand All @@ -28,6 +28,7 @@ export class DnnRmEditFolder {
@State() folderIconUrl: string;
@State() folderDetails: FolderDetails;
@State() foundUsers: ISearchedUser[];
@State() lastPermissions: IPermissions;

private itemsClient: ItemsClient;

Expand Down Expand Up @@ -90,6 +91,7 @@ export class DnnRmEditFolder {
],
},
};
this.lastPermissions = {...this.folderDetails.permissions};
})
.catch(error => alert(error));

Expand Down Expand Up @@ -130,128 +132,107 @@ export class DnnRmEditFolder {
}

private handlePermissionsChanged(newPermissions: IPermissions): void {
newPermissions.rolePermissions.forEach(rolePermission => this.adjustRelatedPermissions(rolePermission));
newPermissions.userPermissions.forEach(userPermission => this.adjustRelatedPermissions(userPermission));
// Get previous role permissions and adjust related permissions
newPermissions.rolePermissions.forEach(rolePermission => {
const previousPermissions = this.lastPermissions?.rolePermissions?.find(p => p.roleId === rolePermission.roleId).permissions ?? [];
this.adjustRelatedPermissions(rolePermission, previousPermissions);
});

// Get previous user permissions and adjust related permissions
newPermissions.userPermissions.forEach(userPermission => {
const previousPermissions = this.lastPermissions?.userPermissions?.find(p => p.userId === userPermission.userId).permissions ?? [];
this.adjustRelatedPermissions(userPermission, previousPermissions);
});

// Update the folder details with the new permissions
this.folderDetails = {
...this.folderDetails,
permissions: newPermissions,
};

// Update the last known permissions state
this.lastPermissions = newPermissions;
}

private adjustRelatedPermissions(permission: IRolePermission | IUserPermission): void {
const permissionId =
{
private adjustRelatedPermissions(permission: IRolePermission | IUserPermission, previousPermissions: IPermissionDefinition[]): void {
const permissionIds = {
view: this.folderDetails.permissions.permissionDefinitions.find(p => p.permissionName === 'View Folder').permissionId,
browse: this.folderDetails.permissions.permissionDefinitions.find(p => p.permissionName === 'Browse Folder').permissionId,
write: this.folderDetails.permissions.permissionDefinitions.find(p => p.permissionName === 'Write to Folder').permissionId,
};

const viewPermission = permission.permissions.find(p => p.permissionId === permissionIds.view);
const browsePermission = permission.permissions.find(p => p.permissionId === permissionIds.browse);
const writePermission = permission.permissions.find(p => p.permissionId === permissionIds.write);

// Check if specific permissions have changed from the last known state
const viewChanged = viewPermission && this.hasPermissionChanged(previousPermissions, viewPermission, permissionIds.view);
const browseChanged = browsePermission && this.hasPermissionChanged(previousPermissions, browsePermission, permissionIds.browse);
const writeChanged = writePermission && this.hasPermissionChanged(previousPermissions, writePermission, permissionIds.write);

const viewPermission = permission.permissions.find(p => p.permissionId == permissionId.view);
// If view permission is denied, then deny all other permissions
if (viewPermission && viewPermission.allowAccess == false){
// Deny all permissions
permission.permissions = [
{
allowAccess: false,
fullControl: false,
permissionId: permissionId.view,
permissionCode: null,
permissionKey: null,
permissionName: "View Folder",
view: false,
},
{
allowAccess: false,
fullControl: false,
permissionId: permissionId.browse,
permissionCode: null,
permissionKey: null,
permissionName: "Browse Folder",
view: false,
},
{
allowAccess: false,
fullControl: false,
permissionId: permissionId.write,
permissionCode: null,
permissionKey: null,
permissionName: "Write to Folder",
view: false,
},
]
if (viewChanged && !viewPermission.allowAccess) {
if (browsePermission) {
browsePermission.allowAccess = false;
}
if (writePermission) {
writePermission.allowAccess = false;
}
}

// If browse was denied, then deny write
const browsePermission = permission.permissions.find(p => p.permissionId == permissionId.browse);
if (browsePermission && browsePermission.allowAccess == false){
// Deny write
permission.permissions = [
...permission.permissions.filter(p => p.permissionId != permissionId.write),
{
allowAccess: false,
fullControl: false,
permissionId: permissionId.write,
permissionCode: null,
permissionKey: null,
permissionName: "Write to Folder",
view: false,
}
]
if (browseChanged && !browsePermission.allowAccess && writePermission) {
writePermission.allowAccess = false;
}

// If browse was allowed, then allow view
if (browsePermission && browsePermission.allowAccess == true){
// Allow browse
permission.permissions = [
{
if (browseChanged && browsePermission.allowAccess) {
if (!viewPermission) {
// Create a new list with all existing permissions plus the new view permission
permission.permissions = [...permission.permissions, {
permissionId: permissionIds.view,
allowAccess: true,
fullControl: false,
permissionId: permissionId.view,
permissionCode: null,
permissionKey: null,
permissionName: "Browse Folder",
permissionName: "View Folder",
view: false,
},
...permission.permissions.filter(p => p.permissionId != permissionId.view),
];
}];
} else {
viewPermission.allowAccess = true;
}
}

// If write was allowed, then allow all other permissions
const writePermission = permission.permissions.find(p => p.permissionId == permissionId.write);
if (writePermission && writePermission.allowAccess == true){
// Allow all permissions
if (writeChanged && writePermission.allowAccess) {
permission.permissions = [
...permission.permissions.filter(p => ![permissionIds.view, permissionIds.browse].includes(p.permissionId)),
{
permissionId: permissionIds.view,
allowAccess: true,
fullControl: false,
permissionId: permissionId.view,
permissionCode: null,
permissionKey: null,
permissionName: "View Folder",
view: false,
},
{
allowAccess: true,
fullControl: false,
permissionId: permissionId.browse,
permissionCode: null,
permissionKey: null,
permissionName: "Browse Folder",
view: false,
},
{
allowAccess: true,
fullControl: false,
permissionId: permissionId.write,
permissionCode: null,
permissionKey: null,
permissionName: "Write to Folder",
view: false,
},
]
permissionId: permissionIds.browse,
allowAccess: true,
fullControl: false,
permissionCode: null,
permissionKey: null,
permissionName: "Browse Folder",
view: false,
}];
}
}

private hasPermissionChanged(lastPermissions: IPermissionDefinition[], currentPermission: IPermissionDefinition, permissionId: number): boolean {
const lastPermission = lastPermissions.find(p => p.permissionId === permissionId)
return !lastPermission || JSON.stringify(lastPermission) !== JSON.stringify(currentPermission);
}

private handleUserSearchQueryChanged(detail: string): void {
this.itemsClient.searchUsers(detail)
.then(data => this.foundUsers = data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
<Reference Include="Castle.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.18.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Moq.4.18.4\lib\net462\Moq.dll</HintPath>
<Reference Include="Moq, Version=4.20.70.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Moq.4.20.70\lib\net462\Moq.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<package id="Microsoft.Build.Tasks.Git" version="8.0.0" targetFramework="net472" developmentDependency="true" />
<package id="Microsoft.SourceLink.Common" version="8.0.0" targetFramework="net472" developmentDependency="true" />
<package id="Microsoft.SourceLink.GitHub" version="8.0.0" targetFramework="net472" developmentDependency="true" />
<package id="Moq" version="4.18.4" targetFramework="net472" />
<package id="Moq" version="4.20.70" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="NUnit" version="3.13.3" targetFramework="net472" />
<package id="NUnit3TestAdapter" version="4.5.0" targetFramework="net472" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
<HintPath>..\..\..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Moq, Version=4.18.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Moq.4.18.4\lib\net462\Moq.dll</HintPath>
<Reference Include="Moq, Version=4.20.70.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Moq.4.20.70\lib\net462\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="5.1.1" targetFramework="net472" />
<package id="Moq" version="4.18.4" targetFramework="net472" />
<package id="Moq" version="4.20.70" targetFramework="net472" />
<package id="NUnit" version="3.13.3" targetFramework="net472" />
<package id="NUnit3TestAdapter" version="4.5.0" targetFramework="net472" />
<package id="StyleCop.Analyzers" version="1.1.118" targetFramework="net472" developmentDependency="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
<Reference Include="Castle.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.18.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Moq.4.18.4\lib\net462\Moq.dll</HintPath>
<Reference Include="Moq, Version=4.20.70.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Moq.4.20.70\lib\net462\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="5.1.1" targetFramework="net472" />
<package id="Moq" version="4.18.4" targetFramework="net472" />
<package id="Moq" version="4.20.70" targetFramework="net472" />
<package id="NUnit" version="3.13.3" targetFramework="net472" />
<package id="NUnit3TestAdapter" version="4.5.0" targetFramework="net472" />
<package id="StyleCop.Analyzers" version="1.1.118" targetFramework="net472" developmentDependency="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.18.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Moq.4.18.4\lib\net462\Moq.dll</HintPath>
<Reference Include="Moq, Version=4.20.70.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Moq.4.20.70\lib\net462\Moq.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<package id="Castle.Core" version="5.1.1" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyInjection" version="2.1.1" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.1.1" targetFramework="net472" />
<package id="Moq" version="4.18.4" targetFramework="net472" />
<package id="Moq" version="4.20.70" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="NUnit" version="3.13.3" targetFramework="net472" />
<package id="NUnit3TestAdapter" version="4.5.0" targetFramework="net472" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.18.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Moq.4.18.4\lib\net462\Moq.dll</HintPath>
<Reference Include="Moq, Version=4.20.70.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Moq.4.20.70\lib\net462\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Tests/DotNetNuke.Tests.Core/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<package id="Castle.Core" version="5.1.1" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyInjection" version="2.1.1" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.1.1" targetFramework="net472" />
<package id="Moq" version="4.18.4" targetFramework="net472" />
<package id="Moq" version="4.20.70" targetFramework="net472" />
<package id="NUnit" version="3.13.3" targetFramework="net472" />
<package id="NUnit3TestAdapter" version="4.5.0" targetFramework="net472" />
<package id="SharpZipLib" version="1.3.3" targetFramework="net472" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
<HintPath>..\..\..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Moq, Version=4.18.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Moq.4.18.4\lib\net462\Moq.dll</HintPath>
<Reference Include="Moq, Version=4.20.70.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Moq.4.20.70\lib\net462\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Tests/DotNetNuke.Tests.Data/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<package id="Microsoft.Extensions.DependencyInjection" version="2.1.1" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.1.1" targetFramework="net472" />
<package id="Microsoft.SqlServer.Compact" version="4.0.8876.1" targetFramework="net45" />
<package id="Moq" version="4.18.4" targetFramework="net472" />
<package id="Moq" version="4.20.70" targetFramework="net472" />
<package id="NUnit" version="3.13.3" targetFramework="net472" />
<package id="NUnit3TestAdapter" version="4.5.0" targetFramework="net472" />
<package id="StyleCop.Analyzers" version="1.1.118" targetFramework="net472" developmentDependency="true" />
Expand Down
Loading
Loading