From da03c276aae54e81084622f875d1fd6a6dbc20bf Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 27 Apr 2017 15:35:26 -0400 Subject: [PATCH] rename AccessAllCollections => AccessAll --- src/Api/Controllers/OrganizationUsersController.cs | 2 +- .../Organizations/OrganizationUserRequestModels.cs | 6 +++--- .../Models/Api/Response/CollectionUserResponseModel.cs | 4 ++-- .../Api/Response/OrganizationUserResponseModel.cs | 4 ++-- src/Core/Models/Data/CollectionUserUserDetails.cs | 2 +- src/Core/Models/Data/OrganizationUserUserDetails.cs | 2 +- src/Core/Models/Table/OrganizationUser.cs | 2 +- src/Core/Services/IOrganizationService.cs | 2 +- .../Services/Implementations/OrganizationService.cs | 10 +++++----- src/Sql/dbo/Functions/UserCanEditCipher.sql | 6 +++--- .../Stored Procedures/CipherDetails_ReadByIdUserId.sql | 4 ++-- .../CipherDetails_ReadByTypeUserId.sql | 4 ++-- .../Stored Procedures/CipherDetails_ReadByUserId.sql | 4 ++-- .../CipherDetails_ReadByUserIdHasCollection.sql | 4 ++-- .../CipherFullDetails_ReadByIdUserId.sql | 4 ++-- .../Stored Procedures/Cipher_UpdateWithCollections.sql | 4 ++-- .../CollectionCipher_ReadByUserId.sql | 4 ++-- .../CollectionCipher_ReadByUserIdCipherId.sql | 4 ++-- .../CollectionCipher_UpdateCollections.sql | 4 ++-- .../CollectionUserUserDetails_ReadByCollectionId.sql | 2 +- .../dbo/Stored Procedures/Collection_ReadByUserId.sql | 4 ++-- src/Sql/dbo/Stored Procedures/Folder_DeleteById.sql | 4 ++-- .../dbo/Stored Procedures/OrganizationUser_Create.sql | 6 +++--- .../dbo/Stored Procedures/OrganizationUser_Update.sql | 4 ++-- src/Sql/dbo/Tables/OrganizationUser.sql | 2 +- src/Sql/dbo/Views/CollectionUserUserDetailsView.sql | 6 +++--- src/Sql/dbo/Views/OrganizationUserUserDetailsView.sql | 2 +- 27 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/Api/Controllers/OrganizationUsersController.cs b/src/Api/Controllers/OrganizationUsersController.cs index 7ec038888f..809cbb4270 100644 --- a/src/Api/Controllers/OrganizationUsersController.cs +++ b/src/Api/Controllers/OrganizationUsersController.cs @@ -75,7 +75,7 @@ namespace Bit.Api.Controllers var userId = _userService.GetProperUserId(User); var result = await _organizationService.InviteUserAsync(orgGuidId, userId.Value, model.Email, model.Type.Value, - model.AccessAllCollections, model.Collections?.Select(c => c.ToCollectionUser())); + model.AccessAll, model.Collections?.Select(c => c.ToCollectionUser())); } [HttpPut("{id}/reinvite")] diff --git a/src/Core/Models/Api/Request/Organizations/OrganizationUserRequestModels.cs b/src/Core/Models/Api/Request/Organizations/OrganizationUserRequestModels.cs index 6a54cd5b29..8a84b23937 100644 --- a/src/Core/Models/Api/Request/Organizations/OrganizationUserRequestModels.cs +++ b/src/Core/Models/Api/Request/Organizations/OrganizationUserRequestModels.cs @@ -12,7 +12,7 @@ namespace Bit.Core.Models.Api public string Email { get; set; } [Required] public Enums.OrganizationUserType? Type { get; set; } - public bool AccessAllCollections { get; set; } + public bool AccessAll { get; set; } public IEnumerable Collections { get; set; } } @@ -32,13 +32,13 @@ namespace Bit.Core.Models.Api { [Required] public Enums.OrganizationUserType? Type { get; set; } - public bool AccessAllCollections { get; set; } + public bool AccessAll { get; set; } public IEnumerable Collections { get; set; } public OrganizationUser ToOrganizationUser(OrganizationUser existingUser) { existingUser.Type = Type.Value; - existingUser.AccessAllCollections = AccessAllCollections; + existingUser.AccessAll = AccessAll; return existingUser; } } diff --git a/src/Core/Models/Api/Response/CollectionUserResponseModel.cs b/src/Core/Models/Api/Response/CollectionUserResponseModel.cs index 4bc1798ac6..c4d8515a9e 100644 --- a/src/Core/Models/Api/Response/CollectionUserResponseModel.cs +++ b/src/Core/Models/Api/Response/CollectionUserResponseModel.cs @@ -18,7 +18,7 @@ namespace Bit.Core.Models.Api Id = collectionUser.Id?.ToString(); OrganizationUserId = collectionUser.OrganizationUserId.ToString(); CollectionId = collectionUser.CollectionId?.ToString(); - AccessAllCollections = collectionUser.AccessAllCollections; + AccessAll = collectionUser.AccessAll; Name = collectionUser.Name; Email = collectionUser.Email; Type = collectionUser.Type; @@ -29,7 +29,7 @@ namespace Bit.Core.Models.Api public string Id { get; set; } public string OrganizationUserId { get; set; } public string CollectionId { get; set; } - public bool AccessAllCollections { get; set; } + public bool AccessAll { get; set; } public string Name { get; set; } public string Email { get; set; } public OrganizationUserType Type { get; set; } diff --git a/src/Core/Models/Api/Response/OrganizationUserResponseModel.cs b/src/Core/Models/Api/Response/OrganizationUserResponseModel.cs index 2f51ec47f4..6075f963e9 100644 --- a/src/Core/Models/Api/Response/OrganizationUserResponseModel.cs +++ b/src/Core/Models/Api/Response/OrganizationUserResponseModel.cs @@ -22,7 +22,7 @@ namespace Bit.Core.Models.Api Email = organizationUser.Email; Type = organizationUser.Type; Status = organizationUser.Status; - AccessAllCollections = organizationUser.AccessAllCollections; + AccessAll = organizationUser.AccessAll; } public string Id { get; set; } @@ -31,7 +31,7 @@ namespace Bit.Core.Models.Api public string Email { get; set; } public OrganizationUserType Type { get; set; } public OrganizationUserStatusType Status { get; set; } - public bool AccessAllCollections { get; set; } + public bool AccessAll { get; set; } } public class OrganizationUserDetailsResponseModel : OrganizationUserResponseModel diff --git a/src/Core/Models/Data/CollectionUserUserDetails.cs b/src/Core/Models/Data/CollectionUserUserDetails.cs index cb5775f082..6611f8f1ae 100644 --- a/src/Core/Models/Data/CollectionUserUserDetails.cs +++ b/src/Core/Models/Data/CollectionUserUserDetails.cs @@ -7,7 +7,7 @@ namespace Bit.Core.Models.Data public Guid? Id { get; set; } public Guid OrganizationUserId { get; set; } public Guid? CollectionId { get; set; } - public bool AccessAllCollections { get; set; } + public bool AccessAll { get; set; } public string Name { get; set; } public string Email { get; set; } public Enums.OrganizationUserStatusType Status { get; set; } diff --git a/src/Core/Models/Data/OrganizationUserUserDetails.cs b/src/Core/Models/Data/OrganizationUserUserDetails.cs index 92ca773c13..1f954c6f77 100644 --- a/src/Core/Models/Data/OrganizationUserUserDetails.cs +++ b/src/Core/Models/Data/OrganizationUserUserDetails.cs @@ -11,6 +11,6 @@ namespace Bit.Core.Models.Data public string Email { get; set; } public Enums.OrganizationUserStatusType Status { get; set; } public Enums.OrganizationUserType Type { get; set; } - public bool AccessAllCollections { get; set; } + public bool AccessAll { get; set; } } } diff --git a/src/Core/Models/Table/OrganizationUser.cs b/src/Core/Models/Table/OrganizationUser.cs index 212858ff5c..f30b6c195c 100644 --- a/src/Core/Models/Table/OrganizationUser.cs +++ b/src/Core/Models/Table/OrganizationUser.cs @@ -13,7 +13,7 @@ namespace Bit.Core.Models.Table public string Key { get; set; } public OrganizationUserStatusType Status { get; set; } public OrganizationUserType Type { get; set; } - public bool AccessAllCollections { get; set; } + public bool AccessAll { get; set; } public DateTime CreationDate { get; internal set; } = DateTime.UtcNow; public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow; diff --git a/src/Core/Services/IOrganizationService.cs b/src/Core/Services/IOrganizationService.cs index 2cb328df0f..33bd3de268 100644 --- a/src/Core/Services/IOrganizationService.cs +++ b/src/Core/Services/IOrganizationService.cs @@ -21,7 +21,7 @@ namespace Bit.Core.Services Task EnableAsync(Guid organizationId); Task UpdateAsync(Organization organization, bool updateBilling = false); Task InviteUserAsync(Guid organizationId, Guid invitingUserId, string email, - Enums.OrganizationUserType type, bool accessAllCollections, IEnumerable collections); + OrganizationUserType type, bool accessAll, IEnumerable collections); Task ResendInviteAsync(Guid organizationId, Guid invitingUserId, Guid organizationUserId); Task AcceptUserAsync(Guid organizationUserId, User user, string token); Task ConfirmUserAsync(Guid organizationId, Guid organizationUserId, string key, Guid confirmingUserId); diff --git a/src/Core/Services/Implementations/OrganizationService.cs b/src/Core/Services/Implementations/OrganizationService.cs index 665b74a78b..27e11df90e 100644 --- a/src/Core/Services/Implementations/OrganizationService.cs +++ b/src/Core/Services/Implementations/OrganizationService.cs @@ -570,7 +570,7 @@ namespace Bit.Core.Services Key = signup.OwnerKey, Type = OrganizationUserType.Owner, Status = OrganizationUserStatusType.Confirmed, - AccessAllCollections = true, + AccessAll = true, CreationDate = DateTime.UtcNow, RevisionDate = DateTime.UtcNow }; @@ -672,7 +672,7 @@ namespace Bit.Core.Services } public async Task InviteUserAsync(Guid organizationId, Guid invitingUserId, string email, - OrganizationUserType type, bool accessAllCollections, IEnumerable collections) + OrganizationUserType type, bool accessAll, IEnumerable collections) { var organization = await _organizationRepository.GetByIdAsync(organizationId); if(organization == null) @@ -705,13 +705,13 @@ namespace Bit.Core.Services Key = null, Type = type, Status = OrganizationUserStatusType.Invited, - AccessAllCollections = accessAllCollections, + AccessAll = accessAll, CreationDate = DateTime.UtcNow, RevisionDate = DateTime.UtcNow }; await _organizationUserRepository.CreateAsync(orgUser); - if(!orgUser.AccessAllCollections && collections.Any()) + if(!orgUser.AccessAll && collections.Any()) { await SaveUserCollectionsAsync(orgUser, collections, true); } @@ -835,7 +835,7 @@ namespace Bit.Core.Services await _organizationUserRepository.ReplaceAsync(user); - if(user.AccessAllCollections) + if(user.AccessAll) { // We don't need any collections if we're flagged to have all access. collections = new List(); diff --git a/src/Sql/dbo/Functions/UserCanEditCipher.sql b/src/Sql/dbo/Functions/UserCanEditCipher.sql index 8b1309146f..3c1a70d344 100644 --- a/src/Sql/dbo/Functions/UserCanEditCipher.sql +++ b/src/Sql/dbo/Functions/UserCanEditCipher.sql @@ -5,7 +5,7 @@ BEGIN ;WITH [CTE] AS( SELECT - CASE WHEN OU.[AccessAllCollections] = 1 OR CU.[ReadOnly] = 0 THEN 1 ELSE 0 END [CanEdit] + CASE WHEN OU.[AccessAll] = 1 OR CU.[ReadOnly] = 0 THEN 1 ELSE 0 END [CanEdit] FROM [dbo].[Cipher] C INNER JOIN @@ -13,14 +13,14 @@ BEGIN INNER JOIN [dbo].[OrganizationUser] OU ON OU.[OrganizationId] = O.[Id] AND OU.[UserId] = @UserId LEFT JOIN - [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAllCollections] = 0 AND CC.[CipherId] = C.[Id] + [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAll] = 0 AND CC.[CipherId] = C.[Id] LEFT JOIN [dbo].[CollectionUser] CU ON CU.[CollectionId] = CC.[CollectionId] AND CU.[OrganizationUserId] = OU.[Id] WHERE C.[Id] = @CipherId AND OU.[Status] = 2 -- 2 = Confirmed AND O.[Enabled] = 1 - AND (OU.[AccessAllCollections] = 1 OR CU.[CollectionId] IS NOT NULL) + AND (OU.[AccessAll] = 1 OR CU.[CollectionId] IS NOT NULL) ) SELECT @CanEdit = CASE WHEN COUNT(1) > 0 THEN 1 ELSE 0 END diff --git a/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByIdUserId.sql b/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByIdUserId.sql index 61a4b6ec9e..6928c65741 100644 --- a/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByIdUserId.sql +++ b/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByIdUserId.sql @@ -14,7 +14,7 @@ BEGIN LEFT JOIN [dbo].[OrganizationUser] OU ON OU.[OrganizationId] = O.[Id] AND OU.[UserId] = @UserId LEFT JOIN - [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAllCollections] = 0 AND CC.[CipherId] = C.[Id] + [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAll] = 0 AND CC.[CipherId] = C.[Id] LEFT JOIN [dbo].[CollectionUser] CU ON CU.[CollectionId] = CC.[CollectionId] AND CU.[OrganizationUserId] = OU.[Id] WHERE @@ -25,7 +25,7 @@ BEGIN C.[UserId] IS NULL AND OU.[Status] = 2 -- 2 = Confirmed AND O.[Enabled] = 1 - AND (OU.[AccessAllCollections] = 1 OR CU.[CollectionId] IS NOT NULL) + AND (OU.[AccessAll] = 1 OR CU.[CollectionId] IS NOT NULL) ) ) END \ No newline at end of file diff --git a/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByTypeUserId.sql b/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByTypeUserId.sql index 0c481d0923..9edef5e578 100644 --- a/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByTypeUserId.sql +++ b/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByTypeUserId.sql @@ -14,7 +14,7 @@ BEGIN LEFT JOIN [dbo].[OrganizationUser] OU ON OU.[OrganizationId] = O.[Id] AND OU.[UserId] = @UserId LEFT JOIN - [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAllCollections] = 0 AND CC.[CipherId] = C.[Id] + [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAll] = 0 AND CC.[CipherId] = C.[Id] LEFT JOIN [dbo].[CollectionUser] CU ON CU.[CollectionId] = CC.[CollectionId] AND CU.[OrganizationUserId] = OU.[Id] WHERE @@ -25,7 +25,7 @@ BEGIN C.[UserId] IS NULL AND OU.[Status] = 2 -- 2 = Confirmed AND O.[Enabled] = 1 - AND (OU.[AccessAllCollections] = 1 OR CU.[CollectionId] IS NOT NULL) + AND (OU.[AccessAll] = 1 OR CU.[CollectionId] IS NOT NULL) ) ) END \ No newline at end of file diff --git a/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByUserId.sql b/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByUserId.sql index 784d715db7..c4d7d787fa 100644 --- a/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByUserId.sql +++ b/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByUserId.sql @@ -13,7 +13,7 @@ BEGIN LEFT JOIN [dbo].[OrganizationUser] OU ON OU.[OrganizationId] = O.[Id] AND OU.[UserId] = @UserId LEFT JOIN - [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAllCollections] = 0 AND CC.[CipherId] = C.[Id] + [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAll] = 0 AND CC.[CipherId] = C.[Id] LEFT JOIN [dbo].[CollectionUser] CU ON CU.[CollectionId] = CC.[CollectionId] AND CU.[OrganizationUserId] = OU.[Id] WHERE @@ -22,6 +22,6 @@ BEGIN C.[UserId] IS NULL AND OU.[Status] = 2 -- 2 = Confirmed AND O.[Enabled] = 1 - AND (OU.[AccessAllCollections] = 1 OR CU.[CollectionId] IS NOT NULL) + AND (OU.[AccessAll] = 1 OR CU.[CollectionId] IS NOT NULL) ) END \ No newline at end of file diff --git a/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByUserIdHasCollection.sql b/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByUserIdHasCollection.sql index d959743324..574717b6b2 100644 --- a/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByUserIdHasCollection.sql +++ b/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByUserIdHasCollection.sql @@ -13,11 +13,11 @@ BEGIN INNER JOIN [dbo].[OrganizationUser] OU ON OU.[OrganizationId] = O.[Id] AND OU.[UserId] = @UserId LEFT JOIN - [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAllCollections] = 0 AND CC.[CipherId] = C.[Id] + [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAll] = 0 AND CC.[CipherId] = C.[Id] LEFT JOIN [dbo].[CollectionUser] CU ON CU.[CollectionId] = CC.[CollectionId] AND CU.[OrganizationUserId] = OU.[Id] WHERE OU.[Status] = 2 -- 2 = Confirmed AND O.[Enabled] = 1 - AND (OU.[AccessAllCollections] = 1 OR CU.[CollectionId] IS NOT NULL) + AND (OU.[AccessAll] = 1 OR CU.[CollectionId] IS NOT NULL) END \ No newline at end of file diff --git a/src/Sql/dbo/Stored Procedures/CipherFullDetails_ReadByIdUserId.sql b/src/Sql/dbo/Stored Procedures/CipherFullDetails_ReadByIdUserId.sql index 3ac0eaefab..dcc017c2dd 100644 --- a/src/Sql/dbo/Stored Procedures/CipherFullDetails_ReadByIdUserId.sql +++ b/src/Sql/dbo/Stored Procedures/CipherFullDetails_ReadByIdUserId.sql @@ -18,7 +18,7 @@ BEGIN LEFT JOIN [dbo].[OrganizationUser] OU ON OU.[OrganizationId] = O.[Id] AND OU.[UserId] = @UserId LEFT JOIN - [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAllCollections] = 0 AND CC.[CipherId] = C.[Id] + [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAll] = 0 AND CC.[CipherId] = C.[Id] LEFT JOIN [dbo].[CollectionUser] CU ON CU.[CollectionId] = CC.[CollectionId] AND CU.[OrganizationUserId] = OU.[Id] WHERE @@ -29,7 +29,7 @@ BEGIN C.[UserId] IS NULL AND OU.[Status] = 2 -- 2 = Confirmed AND O.[Enabled] = 1 - AND (OU.[AccessAllCollections] = 1 OR CU.[CollectionId] IS NOT NULL) + AND (OU.[AccessAll] = 1 OR CU.[CollectionId] IS NOT NULL) ) ) END \ No newline at end of file diff --git a/src/Sql/dbo/Stored Procedures/Cipher_UpdateWithCollections.sql b/src/Sql/dbo/Stored Procedures/Cipher_UpdateWithCollections.sql index 6f4d09a7c5..6a1d7e9d3f 100644 --- a/src/Sql/dbo/Stored Procedures/Cipher_UpdateWithCollections.sql +++ b/src/Sql/dbo/Stored Procedures/Cipher_UpdateWithCollections.sql @@ -34,12 +34,12 @@ BEGIN INNER JOIN [dbo].[OrganizationUser] OU ON OU.[OrganizationId] = O.[Id] AND OU.[UserId] = @UserId LEFT JOIN - [dbo].[CollectionUser] CU ON OU.[AccessAllCollections] = 0 AND CU.[CollectionId] = S.[Id] AND CU.[OrganizationUserId] = OU.[Id] + [dbo].[CollectionUser] CU ON OU.[AccessAll] = 0 AND CU.[CollectionId] = S.[Id] AND CU.[OrganizationUserId] = OU.[Id] WHERE O.[Id] = @OrganizationId AND O.[Enabled] = 1 AND OU.[Status] = 2 -- Confirmed - AND (OU.[AccessAllCollections] = 1 OR CU.[ReadOnly] = 0) + AND (OU.[AccessAll] = 1 OR CU.[ReadOnly] = 0) ) INSERT INTO [dbo].[CollectionCipher] ( diff --git a/src/Sql/dbo/Stored Procedures/CollectionCipher_ReadByUserId.sql b/src/Sql/dbo/Stored Procedures/CollectionCipher_ReadByUserId.sql index aea1a5541f..c489055fed 100644 --- a/src/Sql/dbo/Stored Procedures/CollectionCipher_ReadByUserId.sql +++ b/src/Sql/dbo/Stored Procedures/CollectionCipher_ReadByUserId.sql @@ -13,8 +13,8 @@ BEGIN INNER JOIN [dbo].[OrganizationUser] OU ON OU.[OrganizationId] = S.[OrganizationId] AND OU.[UserId] = @UserId LEFT JOIN - [dbo].[CollectionUser] CU ON OU.[AccessAllCollections] = 0 AND CU.[CollectionId] = S.[Id] AND CU.[OrganizationUserId] = OU.[Id] + [dbo].[CollectionUser] CU ON OU.[AccessAll] = 0 AND CU.[CollectionId] = S.[Id] AND CU.[OrganizationUserId] = OU.[Id] WHERE OU.[Status] = 2 -- Confirmed - AND (OU.[AccessAllCollections] = 1 OR CU.[CollectionId] IS NOT NULL) + AND (OU.[AccessAll] = 1 OR CU.[CollectionId] IS NOT NULL) END \ No newline at end of file diff --git a/src/Sql/dbo/Stored Procedures/CollectionCipher_ReadByUserIdCipherId.sql b/src/Sql/dbo/Stored Procedures/CollectionCipher_ReadByUserIdCipherId.sql index c97cf5d9c3..fa376126df 100644 --- a/src/Sql/dbo/Stored Procedures/CollectionCipher_ReadByUserIdCipherId.sql +++ b/src/Sql/dbo/Stored Procedures/CollectionCipher_ReadByUserIdCipherId.sql @@ -14,9 +14,9 @@ BEGIN INNER JOIN [dbo].[OrganizationUser] OU ON OU.[OrganizationId] = S.[OrganizationId] AND OU.[UserId] = @UserId LEFT JOIN - [dbo].[CollectionUser] CU ON OU.[AccessAllCollections] = 0 AND CU.[CollectionId] = S.[Id] AND CU.[OrganizationUserId] = OU.[Id] + [dbo].[CollectionUser] CU ON OU.[AccessAll] = 0 AND CU.[CollectionId] = S.[Id] AND CU.[OrganizationUserId] = OU.[Id] WHERE SC.[CipherId] = @CipherId AND OU.[Status] = 2 -- Confirmed - AND (OU.[AccessAllCollections] = 1 OR CU.[CollectionId] IS NOT NULL) + AND (OU.[AccessAll] = 1 OR CU.[CollectionId] IS NOT NULL) END \ No newline at end of file diff --git a/src/Sql/dbo/Stored Procedures/CollectionCipher_UpdateCollections.sql b/src/Sql/dbo/Stored Procedures/CollectionCipher_UpdateCollections.sql index 3457a2e897..2a24494a39 100644 --- a/src/Sql/dbo/Stored Procedures/CollectionCipher_UpdateCollections.sql +++ b/src/Sql/dbo/Stored Procedures/CollectionCipher_UpdateCollections.sql @@ -25,12 +25,12 @@ BEGIN INNER JOIN [dbo].[OrganizationUser] OU ON OU.[OrganizationId] = O.[Id] AND OU.[UserId] = @UserId LEFT JOIN - [dbo].[CollectionUser] CU ON OU.[AccessAllCollections] = 0 AND CU.[CollectionId] = S.[Id] AND CU.[OrganizationUserId] = OU.[Id] + [dbo].[CollectionUser] CU ON OU.[AccessAll] = 0 AND CU.[CollectionId] = S.[Id] AND CU.[OrganizationUserId] = OU.[Id] WHERE O.[Id] = @OrgId AND O.[Enabled] = 1 AND OU.[Status] = 2 -- Confirmed - AND (OU.[AccessAllCollections] = 1 OR CU.[ReadOnly] = 0) + AND (OU.[AccessAll] = 1 OR CU.[ReadOnly] = 0) ) MERGE [dbo].[CollectionCipher] AS [Target] diff --git a/src/Sql/dbo/Stored Procedures/CollectionUserUserDetails_ReadByCollectionId.sql b/src/Sql/dbo/Stored Procedures/CollectionUserUserDetails_ReadByCollectionId.sql index be31528ea7..d8c18d8207 100644 --- a/src/Sql/dbo/Stored Procedures/CollectionUserUserDetails_ReadByCollectionId.sql +++ b/src/Sql/dbo/Stored Procedures/CollectionUserUserDetails_ReadByCollectionId.sql @@ -9,6 +9,6 @@ BEGIN FROM [dbo].[CollectionUserUserDetailsView] WHERE - [AccessAllCollections] = 1 + [AccessAll] = 1 OR [CollectionId] = @CollectionId END \ No newline at end of file diff --git a/src/Sql/dbo/Stored Procedures/Collection_ReadByUserId.sql b/src/Sql/dbo/Stored Procedures/Collection_ReadByUserId.sql index bfcae2f71d..c0ddcb4cad 100644 --- a/src/Sql/dbo/Stored Procedures/Collection_ReadByUserId.sql +++ b/src/Sql/dbo/Stored Procedures/Collection_ReadByUserId.sql @@ -13,9 +13,9 @@ BEGIN INNER JOIN [dbo].[OrganizationUser] OU ON OU.[OrganizationId] = O.[Id] AND OU.[UserId] = @UserId LEFT JOIN - [dbo].[CollectionUser] CU ON OU.[AccessAllCollections] = 0 AND CU.[CollectionId] = S.[Id] AND CU.[OrganizationUserId] = OU.[Id] + [dbo].[CollectionUser] CU ON OU.[AccessAll] = 0 AND CU.[CollectionId] = S.[Id] AND CU.[OrganizationUserId] = OU.[Id] WHERE OU.[Status] = 2 -- Confirmed AND O.[Enabled] = 1 - AND (OU.[AccessAllCollections] = 1 OR CU.[CollectionId] IS NOT NULL) + AND (OU.[AccessAll] = 1 OR CU.[CollectionId] IS NOT NULL) END \ No newline at end of file diff --git a/src/Sql/dbo/Stored Procedures/Folder_DeleteById.sql b/src/Sql/dbo/Stored Procedures/Folder_DeleteById.sql index 2bdb550220..38288e8460 100644 --- a/src/Sql/dbo/Stored Procedures/Folder_DeleteById.sql +++ b/src/Sql/dbo/Stored Procedures/Folder_DeleteById.sql @@ -18,14 +18,14 @@ BEGIN LEFT JOIN [dbo].[OrganizationUser] OU ON OU.[OrganizationId] = O.[Id] AND OU.[UserId] = @UserId LEFT JOIN - [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAllCollections] = 0 AND CC.[CipherId] = C.[Id] + [dbo].[CollectionCipher] CC ON C.[UserId] IS NULL AND OU.[AccessAll] = 0 AND CC.[CipherId] = C.[Id] LEFT JOIN [dbo].[CollectionUser] CU ON CU.[CollectionId] = CC.[CollectionId] AND CU.[OrganizationUserId] = OU.[Id] WHERE C.[UserId] = @UserId OR ( C.[UserId] IS NULL - AND (OU.[AccessAllCollections] = 1 OR CU.[CollectionId] IS NOT NULL) + AND (OU.[AccessAll] = 1 OR CU.[CollectionId] IS NOT NULL) ) AND C.[Folders] IS NOT NULL AND JSON_VALUE(C.[Folders], @UserIdPath) = @Id diff --git a/src/Sql/dbo/Stored Procedures/OrganizationUser_Create.sql b/src/Sql/dbo/Stored Procedures/OrganizationUser_Create.sql index 8ca5f27e8f..5ca638028a 100644 --- a/src/Sql/dbo/Stored Procedures/OrganizationUser_Create.sql +++ b/src/Sql/dbo/Stored Procedures/OrganizationUser_Create.sql @@ -6,7 +6,7 @@ @Key VARCHAR(MAX), @Status TINYINT, @Type TINYINT, - @AccessAllCollections BIT, + @AccessAll BIT, @CreationDate DATETIME2(7), @RevisionDate DATETIME2(7) AS @@ -22,7 +22,7 @@ BEGIN [Key], [Status], [Type], - [AccessAllCollections], + [AccessAll], [CreationDate], [RevisionDate] ) @@ -35,7 +35,7 @@ BEGIN @Key, @Status, @Type, - @AccessAllCollections, + @AccessAll, @CreationDate, @RevisionDate ) diff --git a/src/Sql/dbo/Stored Procedures/OrganizationUser_Update.sql b/src/Sql/dbo/Stored Procedures/OrganizationUser_Update.sql index 5fa1479508..6242e366fd 100644 --- a/src/Sql/dbo/Stored Procedures/OrganizationUser_Update.sql +++ b/src/Sql/dbo/Stored Procedures/OrganizationUser_Update.sql @@ -6,7 +6,7 @@ @Key VARCHAR(MAX), @Status TINYINT, @Type TINYINT, - @AccessAllCollections BIT, + @AccessAll BIT, @CreationDate DATETIME2(7), @RevisionDate DATETIME2(7) AS @@ -22,7 +22,7 @@ BEGIN [Key] = @Key, [Status] = @Status, [Type] = @Type, - [AccessAllCollections] = @AccessAllCollections, + [AccessAll] = @AccessAll, [CreationDate] = @CreationDate, [RevisionDate] = @RevisionDate WHERE diff --git a/src/Sql/dbo/Tables/OrganizationUser.sql b/src/Sql/dbo/Tables/OrganizationUser.sql index f8ea015e32..425de68b24 100644 --- a/src/Sql/dbo/Tables/OrganizationUser.sql +++ b/src/Sql/dbo/Tables/OrganizationUser.sql @@ -6,7 +6,7 @@ [Key] VARCHAR (MAX) NULL, [Status] TINYINT NOT NULL, [Type] TINYINT NOT NULL, - [AccessAllCollections] BIT NOT NULL, + [AccessAll] BIT NOT NULL, [CreationDate] DATETIME2 (7) NOT NULL, [RevisionDate] DATETIME2 (7) NOT NULL, CONSTRAINT [PK_OrganizationUser] PRIMARY KEY CLUSTERED ([Id] ASC), diff --git a/src/Sql/dbo/Views/CollectionUserUserDetailsView.sql b/src/Sql/dbo/Views/CollectionUserUserDetailsView.sql index 59264112fc..101927070f 100644 --- a/src/Sql/dbo/Views/CollectionUserUserDetailsView.sql +++ b/src/Sql/dbo/Views/CollectionUserUserDetailsView.sql @@ -2,17 +2,17 @@ AS SELECT OU.[Id] AS [OrganizationUserId], - OU.[AccessAllCollections], + OU.[AccessAll], CU.[Id], CU.[CollectionId], U.[Name], ISNULL(U.[Email], OU.[Email]) Email, OU.[Status], OU.[Type], - CASE WHEN OU.[AccessAllCollections] = 0 AND CU.[ReadOnly] = 1 THEN 1 ELSE 0 END [ReadOnly] + CASE WHEN OU.[AccessAll] = 0 AND CU.[ReadOnly] = 1 THEN 1 ELSE 0 END [ReadOnly] FROM [dbo].[OrganizationUser] OU LEFT JOIN - [dbo].[CollectionUser] CU ON OU.[AccessAllCollections] = 0 AND CU.[OrganizationUserId] = OU.[Id] + [dbo].[CollectionUser] CU ON OU.[AccessAll] = 0 AND CU.[OrganizationUserId] = OU.[Id] LEFT JOIN [dbo].[User] U ON U.[Id] = OU.[UserId] \ No newline at end of file diff --git a/src/Sql/dbo/Views/OrganizationUserUserDetailsView.sql b/src/Sql/dbo/Views/OrganizationUserUserDetailsView.sql index 161eea200c..0bea008006 100644 --- a/src/Sql/dbo/Views/OrganizationUserUserDetailsView.sql +++ b/src/Sql/dbo/Views/OrganizationUserUserDetailsView.sql @@ -8,7 +8,7 @@ SELECT ISNULL(U.[Email], OU.[Email]) Email, OU.[Status], OU.[Type], - OU.[AccessAllCollections] + OU.[AccessAll] FROM [dbo].[OrganizationUser] OU LEFT JOIN