mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 21:18:13 -05:00
lowercase op string comparisons (#2129)
This commit is contained in:
parent
903273885b
commit
1764d2446e
@ -163,11 +163,12 @@ namespace Bit.Scim.Controllers.v2
|
|||||||
|
|
||||||
var operationHandled = false;
|
var operationHandled = false;
|
||||||
|
|
||||||
var replaceOp = model.Operations?.FirstOrDefault(o => o.Op == "replace");
|
var replaceOp = model.Operations?.FirstOrDefault(o =>
|
||||||
|
o.Op?.ToLowerInvariant() == "replace");
|
||||||
if (replaceOp != null)
|
if (replaceOp != null)
|
||||||
{
|
{
|
||||||
// Replace a list of members
|
// Replace a list of members
|
||||||
if (replaceOp.Path == "members")
|
if (replaceOp.Path?.ToLowerInvariant() == "members")
|
||||||
{
|
{
|
||||||
var ids = GetOperationValueIds(replaceOp.Value);
|
var ids = GetOperationValueIds(replaceOp.Value);
|
||||||
await _groupRepository.UpdateUsersAsync(group.Id, ids);
|
await _groupRepository.UpdateUsersAsync(group.Id, ids);
|
||||||
@ -184,7 +185,9 @@ namespace Bit.Scim.Controllers.v2
|
|||||||
|
|
||||||
// Add a single member
|
// Add a single member
|
||||||
var addMemberOp = model.Operations?.FirstOrDefault(
|
var addMemberOp = model.Operations?.FirstOrDefault(
|
||||||
o => o.Op == "add" && !string.IsNullOrWhiteSpace(o.Path) && o.Path.StartsWith("members[value eq "));
|
o => o.Op?.ToLowerInvariant() == "add" &&
|
||||||
|
!string.IsNullOrWhiteSpace(o.Path) &&
|
||||||
|
o.Path.ToLowerInvariant().StartsWith("members[value eq "));
|
||||||
if (addMemberOp != null)
|
if (addMemberOp != null)
|
||||||
{
|
{
|
||||||
var addId = GetOperationPathId(addMemberOp.Path);
|
var addId = GetOperationPathId(addMemberOp.Path);
|
||||||
@ -198,7 +201,9 @@ namespace Bit.Scim.Controllers.v2
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add a list of members
|
// Add a list of members
|
||||||
var addMembersOp = model.Operations?.FirstOrDefault(o => o.Op == "add" && o.Path == "members");
|
var addMembersOp = model.Operations?.FirstOrDefault(o =>
|
||||||
|
o.Op?.ToLowerInvariant() == "add" &&
|
||||||
|
o.Path?.ToLowerInvariant() == "members");
|
||||||
if (addMembersOp != null)
|
if (addMembersOp != null)
|
||||||
{
|
{
|
||||||
var orgUserIds = (await _groupRepository.GetManyUserIdsByIdAsync(group.Id)).ToHashSet();
|
var orgUserIds = (await _groupRepository.GetManyUserIdsByIdAsync(group.Id)).ToHashSet();
|
||||||
@ -212,7 +217,9 @@ namespace Bit.Scim.Controllers.v2
|
|||||||
|
|
||||||
// Remove a single member
|
// Remove a single member
|
||||||
var removeMemberOp = model.Operations?.FirstOrDefault(
|
var removeMemberOp = model.Operations?.FirstOrDefault(
|
||||||
o => o.Op == "remove" && !string.IsNullOrWhiteSpace(o.Path) && o.Path.StartsWith("members[value eq "));
|
o => o.Op?.ToLowerInvariant() == "remove" &&
|
||||||
|
!string.IsNullOrWhiteSpace(o.Path) &&
|
||||||
|
o.Path.ToLowerInvariant().StartsWith("members[value eq "));
|
||||||
if (removeMemberOp != null)
|
if (removeMemberOp != null)
|
||||||
{
|
{
|
||||||
var removeId = GetOperationPathId(removeMemberOp.Path);
|
var removeId = GetOperationPathId(removeMemberOp.Path);
|
||||||
@ -224,7 +231,9 @@ namespace Bit.Scim.Controllers.v2
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove a list of members
|
// Remove a list of members
|
||||||
var removeMembersOp = model.Operations?.FirstOrDefault(o => o.Op == "remove" && o.Path == "members");
|
var removeMembersOp = model.Operations?.FirstOrDefault(o =>
|
||||||
|
o.Op?.ToLowerInvariant() == "remove" &&
|
||||||
|
o.Path?.ToLowerInvariant() == "members");
|
||||||
if (removeMembersOp != null)
|
if (removeMembersOp != null)
|
||||||
{
|
{
|
||||||
var orgUserIds = (await _groupRepository.GetManyUserIdsByIdAsync(group.Id)).ToHashSet();
|
var orgUserIds = (await _groupRepository.GetManyUserIdsByIdAsync(group.Id)).ToHashSet();
|
||||||
|
@ -220,7 +220,8 @@ namespace Bit.Scim.Controllers.v2
|
|||||||
|
|
||||||
var operationHandled = false;
|
var operationHandled = false;
|
||||||
|
|
||||||
var replaceOp = model.Operations?.FirstOrDefault(o => o.Op == "replace");
|
var replaceOp = model.Operations?.FirstOrDefault(o =>
|
||||||
|
o.Op?.ToLowerInvariant() == "replace");
|
||||||
if (replaceOp != null)
|
if (replaceOp != null)
|
||||||
{
|
{
|
||||||
if (replaceOp.Value.TryGetProperty("active", out var activeProperty))
|
if (replaceOp.Value.TryGetProperty("active", out var activeProperty))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user