Skip to content

Commit 4fc751f

Browse files
author
Warren Buckley
committed
Nullable fixes UserTagHelper
1 parent d529a6c commit 4fc751f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Our.Umbraco.TagHelpers/UserTagHelper.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ public class UserTagHelper : TagHelper
2424
/// * = All authenticated users
2525
/// </summary>
2626
[HtmlAttributeName("our-user-exclude")]
27-
public string ExcludeGroups { get; set; }
27+
public string? ExcludeGroups { get; set; }
2828

2929
/// <summary>
3030
/// A comma separated list of User Groups to include
3131
/// ? = All anonymous users
3232
/// * = All authenticated users
3333
/// </summary>
3434
[HtmlAttributeName("our-user-include")]
35-
public string IncludeGroups { get; set; }
35+
public string? IncludeGroups { get; set; }
3636

3737
public UserTagHelper(IBackofficeUserAccessor backofficeUserAccessor)
3838
{
@@ -47,21 +47,21 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
4747
{
4848
var groups = currentUser.GetRoles();
4949
currentUserGroups.AddRange(groups);
50-
}
5150

52-
// Process excluded roles
53-
if (!string.IsNullOrWhiteSpace(this.ExcludeGroups) && IsUserInRole(currentUser, ExcludeGroups, currentUserGroups) == true)
54-
{
55-
output.SuppressOutput();
56-
return;
57-
}
51+
// Process excluded roles
52+
if (!string.IsNullOrWhiteSpace(this.ExcludeGroups) && IsUserInRole(currentUser, ExcludeGroups, currentUserGroups) == true)
53+
{
54+
output.SuppressOutput();
55+
return;
56+
}
5857

59-
// Process included roles
60-
else if (!string.IsNullOrWhiteSpace(this.IncludeGroups) && IsUserInRole(currentUser, IncludeGroups, currentUserGroups) == false)
61-
{
62-
output.SuppressOutput();
63-
return;
64-
}
58+
// Process included roles
59+
else if (!string.IsNullOrWhiteSpace(this.IncludeGroups) && IsUserInRole(currentUser, IncludeGroups, currentUserGroups) == false)
60+
{
61+
output.SuppressOutput();
62+
return;
63+
}
64+
}
6565
}
6666

6767
private bool IsUserInRole(ClaimsIdentity currentUser, string roleString, List<string> currentMemberRoles)

0 commit comments

Comments
 (0)