@@ -17,17 +17,20 @@ public class PageMetricsNotificationHandler : INotificationHandler<UmbracoApplic
17
17
private readonly ICoreScopeProvider _coreScopeProvider ;
18
18
private readonly IKeyValueService _keyValueService ;
19
19
private readonly IRuntimeState _runtimeState ;
20
+ private readonly IUserService _userService ;
20
21
21
22
public PageMetricsNotificationHandler (
22
23
ICoreScopeProvider coreScopeProvider ,
23
24
IMigrationPlanExecutor migrationPlanExecutor ,
24
25
IKeyValueService keyValueService ,
25
- IRuntimeState runtimeState )
26
+ IRuntimeState runtimeState ,
27
+ IUserService userService )
26
28
{
27
29
_migrationPlanExecutor = migrationPlanExecutor ;
28
30
_coreScopeProvider = coreScopeProvider ;
29
31
_keyValueService = keyValueService ;
30
32
_runtimeState = runtimeState ;
33
+ _userService = userService ;
31
34
}
32
35
33
36
public void Handle ( UmbracoApplicationStartingNotification notification )
@@ -54,6 +57,16 @@ public void Handle(UmbracoApplicationStartingNotification notification)
54
57
_migrationPlanExecutor ,
55
58
_coreScopeProvider ,
56
59
_keyValueService ) ;
60
+
61
+ var adminGroup = _userService . GetUserGroupByAlias ( Cms . Core . Constants . Security . AdminGroupAlias ) ;
62
+ if ( adminGroup != null )
63
+ {
64
+ if ( ! adminGroup . AllowedSections . Contains ( Constants . SectionAlias ) )
65
+ {
66
+ adminGroup . AddAllowedSection ( Constants . SectionAlias ) ;
67
+ _userService . Save ( adminGroup ) ;
68
+ }
69
+ }
57
70
}
58
71
}
59
72
}
0 commit comments