Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
226
Issues
226
List
Boards
Labels
Service Desk
Milestones
Merge Requests
30
Merge Requests
30
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
eb3c70ee
Commit
eb3c70ee
authored
54 minutes ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(chore): log mobile users with sentry
parent
b3937061
master
No related merge requests found
Pipeline
#77849065
passed with stages
in 17 minutes and 1 second
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
SentryScopeDelegate.php
Core/OAuth/Repositories/Delegates/SentryScopeDelegate.php
+25
-0
UserRepository.php
Core/OAuth/Repositories/UserRepository.php
+9
-1
No files found.
Core/OAuth/Repositories/Delegates/SentryScopeDelegate.php
0 → 100644
View file @
eb3c70ee
<?php
namespace
Minds\Core\OAuth\Repositories\Delegates
;
use
Sentry
;
use
Minds\Core\OAuth\Entities\UserEntity
;
class
SentryScopeDelegate
{
/**
* Pass through a user guid to sentry
* @param UserEntity $entity
* @return void
*/
public
function
onGetUserEntity
(
UserEntity
$entity
)
:
void
{
Sentry\configureScope
(
function
(
Sentry\State\Scope
$scope
)
use
(
$entity
)
:
void
{
$scope
->
setUser
([
'id'
=>
(
string
)
$entity
->
getIdentifier
(),
]);
});
}
}
This diff is collapsed.
Click to expand it.
Core/OAuth/Repositories/UserRepository.php
View file @
eb3c70ee
...
...
@@ -15,12 +15,16 @@ class UserRepository implements UserRepositoryInterface
/** @var Password $password */
private
$password
;
/** @var SentryScopeDelegate $sentryScopeDelegate */
private
$sentryScopeDelegate
;
/** @var User $mock */
public
$mockUser
=
false
;
public
function
__construct
(
Password
$password
=
null
)
public
function
__construct
(
Password
$password
=
null
,
SentryScopeDelegate
$sentryScopeDelegate
=
null
)
{
$this
->
password
=
$password
?:
Di
::
_
()
->
get
(
'Security\Password'
);
$this
->
sentryScopeDelegate
=
$sentryScopeDelegate
??
new
Delegates\SentryScopeDelegate
;
}
/**
...
...
@@ -52,6 +56,10 @@ class UserRepository implements UserRepositoryInterface
$entity
=
new
UserEntity
();
$entity
->
setIdentifier
(
$user
->
getGuid
());
// Update Sentry scope with our user
$this
->
sentryScopeDelegate
->
onGetUserEntity
(
$entity
);
return
$entity
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment