mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 17:42:49 -05:00
[AC-1117] Add manage permission (#3126)
* Update sql files to add Manage permission * Add migration script * Rename collection manage migration file to remove duplicate migration date * Migrations * Add manage to models * Add manage to repository * Add constraint to Manage columns * Migration lint fixes * Add manage to OrganizationUserUserDetails_ReadWithCollectionsById * Add missing manage fields * Add 'Manage' to UserCollectionDetails * Use CREATE OR ALTER where possible
This commit is contained in:
@ -33,6 +33,7 @@ public class OrganizationUserRepository : Repository<Core.Entities.OrganizationU
|
||||
OrganizationUserId = organizationUser.Id,
|
||||
ReadOnly = y.ReadOnly,
|
||||
HidePasswords = y.HidePasswords,
|
||||
Manage = y.Manage
|
||||
});
|
||||
await dbContext.CollectionUsers.AddRangeAsync(collectionUsers);
|
||||
await dbContext.SaveChangesAsync();
|
||||
@ -141,6 +142,7 @@ public class OrganizationUserRepository : Repository<Core.Entities.OrganizationU
|
||||
Id = cu.CollectionId,
|
||||
ReadOnly = cu.ReadOnly,
|
||||
HidePasswords = cu.HidePasswords,
|
||||
Manage = cu.Manage,
|
||||
});
|
||||
return new Tuple<Core.Entities.OrganizationUser, ICollection<CollectionAccessSelection>>(
|
||||
organizationUser, collections.ToList());
|
||||
@ -235,6 +237,7 @@ public class OrganizationUserRepository : Repository<Core.Entities.OrganizationU
|
||||
Id = cu.CollectionId,
|
||||
ReadOnly = cu.ReadOnly,
|
||||
HidePasswords = cu.HidePasswords,
|
||||
Manage = cu.Manage
|
||||
}).ToListAsync();
|
||||
return new Tuple<OrganizationUserUserDetails, ICollection<CollectionAccessSelection>>(organizationUserUserDetails, collections);
|
||||
}
|
||||
@ -360,7 +363,8 @@ public class OrganizationUserRepository : Repository<Core.Entities.OrganizationU
|
||||
{
|
||||
Id = cu.CollectionId,
|
||||
ReadOnly = cu.ReadOnly,
|
||||
HidePasswords = cu.HidePasswords
|
||||
HidePasswords = cu.HidePasswords,
|
||||
Manage = cu.Manage,
|
||||
}).ToList() ?? new List<CollectionAccessSelection>();
|
||||
}
|
||||
}
|
||||
@ -440,6 +444,7 @@ public class OrganizationUserRepository : Repository<Core.Entities.OrganizationU
|
||||
OrganizationUserId = obj.Id,
|
||||
HidePasswords = requestedCollection.HidePasswords,
|
||||
ReadOnly = requestedCollection.ReadOnly,
|
||||
Manage = requestedCollection.Manage
|
||||
});
|
||||
continue;
|
||||
}
|
||||
@ -447,6 +452,7 @@ public class OrganizationUserRepository : Repository<Core.Entities.OrganizationU
|
||||
// It already exists, update it
|
||||
existingCollectionUser.HidePasswords = requestedCollection.HidePasswords;
|
||||
existingCollectionUser.ReadOnly = requestedCollection.ReadOnly;
|
||||
existingCollectionUser.Manage = requestedCollection.Manage;
|
||||
dbContext.CollectionUsers.Update(existingCollectionUser);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user