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

Add limit item deletion organization setting migration #5283

Merged
merged 7 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
6 changes: 6 additions & 0 deletions src/Core/AdminConsole/Entities/Organization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ public class Organization : ITableObject<Guid>, IStorableSubscriber, IRevisable,
/// </summary>
public bool AllowAdminAccessToAllCollectionItems { get; set; }

/// <summary>
/// If set to true, members can only delete items when they have a Can Manage permission over the collection.
/// If set to false, members can delete items when they have a Can Manage OR Can Edit permission over the collection.
/// </summary>
public bool LimitItemDeletion { get; set; }

/// <summary>
/// Risk Insights is a reporting feature that provides insights into the security of an organization's vault.
/// </summary>
Expand Down
9 changes: 6 additions & 3 deletions src/Sql/dbo/Stored Procedures/Organization_Create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ CREATE PROCEDURE [dbo].[Organization_Create]
@LimitCollectionCreation BIT = NULL,
@LimitCollectionDeletion BIT = NULL,
@AllowAdminAccessToAllCollectionItems BIT = 0,
@UseRiskInsights BIT = 0
@UseRiskInsights BIT = 0,
@LimitItemDeletion BIT = 0
AS
BEGIN
SET NOCOUNT ON
Expand Down Expand Up @@ -116,7 +117,8 @@ BEGIN
[LimitCollectionCreation],
[LimitCollectionDeletion],
[AllowAdminAccessToAllCollectionItems],
[UseRiskInsights]
[UseRiskInsights],
[LimitItemDeletion]
)
VALUES
(
Expand Down Expand Up @@ -175,6 +177,7 @@ BEGIN
@LimitCollectionCreation,
@LimitCollectionDeletion,
@AllowAdminAccessToAllCollectionItems,
@UseRiskInsights
@UseRiskInsights,
@LimitItemDeletion
)
END
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ BEGIN
[LimitCollectionCreation],
[LimitCollectionDeletion],
[AllowAdminAccessToAllCollectionItems],
[UseRiskInsights]
r-tome marked this conversation as resolved.
Show resolved Hide resolved
[LimitItemDeletion]
FROM
[dbo].[Organization]
END
6 changes: 4 additions & 2 deletions src/Sql/dbo/Stored Procedures/Organization_Update.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ CREATE PROCEDURE [dbo].[Organization_Update]
@LimitCollectionCreation BIT = null,
@LimitCollectionDeletion BIT = null,
@AllowAdminAccessToAllCollectionItems BIT = 0,
@UseRiskInsights BIT = 0
@UseRiskInsights BIT = 0,
@LimitItemDeletion BIT = 0
AS
BEGIN
SET NOCOUNT ON
Expand Down Expand Up @@ -116,7 +117,8 @@ BEGIN
[LimitCollectionCreation] = @LimitCollectionCreation,
[LimitCollectionDeletion] = @LimitCollectionDeletion,
[AllowAdminAccessToAllCollectionItems] = @AllowAdminAccessToAllCollectionItems,
[UseRiskInsights] = @UseRiskInsights
[UseRiskInsights] = @UseRiskInsights,
[LimitItemDeletion] = @LimitItemDeletion
WHERE
[Id] = @Id
END
1 change: 1 addition & 0 deletions src/Sql/dbo/Tables/Organization.sql
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ CREATE TABLE [dbo].[Organization] (
[SecretsManagerBeta] BIT NOT NULL CONSTRAINT [DF_Organization_SecretsManagerBeta] DEFAULT (0),
[LimitCollectionCreation] BIT NOT NULL CONSTRAINT [DF_Organization_LimitCollectionCreation] DEFAULT (0),
[LimitCollectionDeletion] BIT NOT NULL CONSTRAINT [DF_Organization_LimitCollectionDeletion] DEFAULT (0),
[LimitItemDeletion] BIT NOT NULL CONSTRAINT [DF_Organization_LimitItemDeletion] DEFAULT (0),
[AllowAdminAccessToAllCollectionItems] BIT NOT NULL CONSTRAINT [DF_Organization_AllowAdminAccessToAllCollectionItems] DEFAULT (0),
[UseRiskInsights] BIT NOT NULL CONSTRAINT [DF_Organization_UseRiskInsights] DEFAULT (0),
CONSTRAINT [PK_Organization] PRIMARY KEY CLUSTERED ([Id] ASC)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ SELECT
O.[LimitCollectionCreation],
O.[LimitCollectionDeletion],
O.[AllowAdminAccessToAllCollectionItems],
O.[UseRiskInsights]
O.[UseRiskInsights],
O.[LimitItemDeletion]
FROM
[dbo].[OrganizationUser] OU
LEFT JOIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ SELECT
O.[LimitCollectionDeletion],
O.[AllowAdminAccessToAllCollectionItems],
O.[UseRiskInsights],
P.[Type] ProviderType
P.[Type] ProviderType,
O.[LimitItemDeletion]
FROM
[dbo].[ProviderUser] PU
INNER JOIN
Expand Down
Loading
Loading