Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dbp-relay-server-template
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Relay API Gateway
dbp-relay-server-template
Commits
b0b02c6d
Commit
b0b02c6d
authored
4 years ago
by
Reiter, Christoph
Browse files
Options
Downloads
Patches
Plain Diff
Use a dummy person provider by default
parent
cd5e807c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/services.yaml
+7
-0
7 additions, 0 deletions
config/services.yaml
src/Service/MyCustomPersonProvider.php
+20
-10
20 additions, 10 deletions
src/Service/MyCustomPersonProvider.php
with
27 additions
and
10 deletions
config/services.yaml
+
7
−
0
View file @
b0b02c6d
services
:
App\Service\
:
resource
:
'
../src/Service'
autowire
:
true
# Replace the core one with our custom (dummy) implementation.
DBP\API\CoreBundle\Service\PersonProviderInterface
:
'
@App\Service\MyCustomPersonProvider'
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/MyCustomPersonProvider.php
→
src/
Service/
MyCustomPersonProvider.php
+
20
−
10
View file @
b0b02c6d
...
...
@@ -2,46 +2,56 @@
declare
(
strict_types
=
1
);
namespace
App
;
namespace
App
\Service
;
use
DBP\API\CoreBundle\Entity\Person
;
use
DBP\API\CoreBundle\Service\PersonProviderInterface
;
use
Symfony\Component\Security\Core\Security
;
class
MyCustomPersonProvider
implements
PersonProviderInterface
{
private
$security
;
public
function
__construct
(
Security
$security
)
{
$this
->
security
=
$security
;
}
public
function
getPersons
(
array
$filters
):
array
{
// TODO: Implement getPersons() method.
return
[];
return
[
$this
->
getCurrentPerson
()];
}
public
function
getPersonsByNameAndBirthday
(
string
$givenName
,
string
$familyName
,
\DateTime
$birthDay
)
:
array
{
// TODO: Implement getPersonsByNameAndBirthday() method.
return
[];
}
public
function
getPerson
(
string
$id
):
Person
{
// TODO: Implement getPerson() method.
return
new
Person
();
$person
=
new
Person
();
$person
->
setIdentifier
(
$id
);
$person
->
setGivenName
(
'John'
);
$person
->
setFamilyName
(
'Doe'
);
$person
->
setEmail
(
'john.doe@example.com'
);
return
$person
;
}
public
function
getCurrentPerson
():
Person
{
// TODO: Implement getCurrentPerson() method.
return
new
Person
();
$user
=
$this
->
security
->
getUser
();
return
$this
->
getPerson
(
$user
->
getUsername
());
}
public
function
getPersonForExternalService
(
string
$service
,
string
$serviceID
):
Person
{
// TODO: Implement getPersonForExternalService() method.
return
new
Person
();
}
public
function
getRolesForScopes
(
array
$scopes
):
array
{
// TODO: Implement getRolesForScopes() method.
return
[];
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment