1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

Return collection with highest permission levels

This commit is contained in:
Thomas Rittson 2021-07-20 11:46:30 +10:00
parent 2419bc2928
commit 06e0f3b73e

View File

@ -107,7 +107,21 @@ namespace Bit.Core.Repositories.SqlServer
// Return distinct Id results.
return results
.GroupBy(c => c.Id)
.Select(c => c.First())
.Select(grouping =>
{
var first = grouping.First();
if (first.HidePasswords)
{
first.HidePasswords = !grouping.Any(c => !c.HidePasswords);
}
if (first.ReadOnly)
{
first.ReadOnly = !grouping.Any(c => !c.ReadOnly);
}
return first;
})
.ToList();
}
}