@@ -24,15 +24,15 @@ public class UserTagHelper : TagHelper
24
24
/// * = All authenticated users
25
25
/// </summary>
26
26
[ HtmlAttributeName ( "our-user-exclude" ) ]
27
- public string ExcludeGroups { get ; set ; }
27
+ public string ? ExcludeGroups { get ; set ; }
28
28
29
29
/// <summary>
30
30
/// A comma separated list of User Groups to include
31
31
/// ? = All anonymous users
32
32
/// * = All authenticated users
33
33
/// </summary>
34
34
[ HtmlAttributeName ( "our-user-include" ) ]
35
- public string IncludeGroups { get ; set ; }
35
+ public string ? IncludeGroups { get ; set ; }
36
36
37
37
public UserTagHelper ( IBackofficeUserAccessor backofficeUserAccessor )
38
38
{
@@ -47,21 +47,21 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
47
47
{
48
48
var groups = currentUser . GetRoles ( ) ;
49
49
currentUserGroups . AddRange ( groups ) ;
50
- }
51
50
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
+ }
58
57
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
+ }
65
65
}
66
66
67
67
private bool IsUserInRole ( ClaimsIdentity currentUser , string roleString , List < string > currentMemberRoles )
0 commit comments