Skip to content

Commit

Permalink
custom_att
Browse files Browse the repository at this point in the history
  • Loading branch information
Utar94 committed Dec 15, 2024
1 parent 2a61504 commit 357e7f2
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/Logitar.Identity.Core/Roles/Role.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,20 @@ public void RemoveCustomAttribute(string key)
}

/// <summary>
/// Sets the specified custom attribute on the role.
/// Sets the specified custom attribute on the role. If the value is null, empty or only white-space, the custom attribute will be removed.
/// </summary>
/// <param name="key">The key of the custom attribute.</param>
/// <param name="value">The value of the custom attribute.</param>
public void SetCustomAttribute(string key, string value)
{
//if (string.IsNullOrWhiteSpace(key))
//{
// RemoveCustomAttribute(key);
//}

//key = key.Trim();
//value = value.Trim();
// TODO(fpion): validate
if (string.IsNullOrWhiteSpace(key))
{
RemoveCustomAttribute(key);
}

key = key.Trim();
value = value.Trim();
// TODO(fpion): validate key

if (!_customAttributes.TryGetValue(key, out string? existingValue) || existingValue != value)
{
Expand Down

0 comments on commit 357e7f2

Please sign in to comment.