File tree Expand file tree Collapse file tree 3 files changed +67
-0
lines changed Expand file tree Collapse file tree 3 files changed +67
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Neos \Neos \UserIdProvider ;
6
+
7
+ use Neos \ContentRepository \Core \SharedModel \User \UserId ;
8
+ use Neos \ContentRepository \Core \SharedModel \User \UserIdProviderInterface ;
9
+ use Neos \Neos \Domain \Service \UserService ;
10
+
11
+ /**
12
+ * @api
13
+ */
14
+ final class UserIdProvider implements UserIdProviderInterface
15
+ {
16
+ public function __construct (
17
+ private readonly UserService $ userService
18
+ ) {
19
+ }
20
+
21
+ public function getUserId (): UserId
22
+ {
23
+ $ userId = $ this ->userService ->getCurrentUserIdentifier ();
24
+ if ($ userId === null ) {
25
+ return UserId::forSystemUser ();
26
+ }
27
+ return UserId::fromString ($ userId ->value );
28
+ }
29
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Neos \Neos \UserIdProvider ;
6
+
7
+ use Neos \ContentRepository \Core \Factory \ContentRepositoryId ;
8
+ use Neos \ContentRepository \Core \SharedModel \User \UserIdProviderInterface ;
9
+ use Neos \ContentRepositoryRegistry \Factory \UserIdProvider \UserIdProviderFactoryInterface ;
10
+ use Neos \Flow \Annotations as Flow ;
11
+ use Neos \Neos \Domain \Service \UserService ;
12
+
13
+ /**
14
+ * Implementation of the Neos AssetUsageStrategyInterface in order to protect assets in use
15
+ * to be deleted via the Media Module.
16
+ *
17
+ * @api
18
+ */
19
+ #[Flow \Scope('singleton ' )]
20
+ final class UserIdProviderFactory implements UserIdProviderFactoryInterface
21
+ {
22
+ public function __construct (
23
+ private readonly UserService $ userService
24
+ ) {
25
+ }
26
+
27
+ /**
28
+ * @param array<string, mixed> $options
29
+ */
30
+ public function build (ContentRepositoryId $ contentRepositoryId , array $ options ): UserIdProviderInterface
31
+ {
32
+ return new UserIdProvider ($ this ->userService );
33
+ }
34
+ }
Original file line number Diff line number Diff line change 2
2
ContentRepositoryRegistry :
3
3
presets :
4
4
' default ' :
5
+
6
+ userIdProvider :
7
+ factoryObjectName : Neos\Neos\UserIdProvider\UserIdProviderFactory
8
+
5
9
projections :
6
10
' Neos.Neos:DocumentUriPathProjection ' :
7
11
factoryObjectName : Neos\Neos\FrontendRouting\Projection\DocumentUriPathProjectionFactory
You can’t perform that action at this time.
0 commit comments