Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
violinist_teams
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
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
Show more breadcrumbs
project
violinist_teams
Commits
e4f926cb
Commit
e4f926cb
authored
8 months ago
by
Eirik Morland
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3453770
: Add a method to indicate if a team can view logs
parent
a88b687f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!63
Add the method
Pipeline
#196032
passed with warnings
8 months ago
Stage: build
Stage: validate
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/TeamNode.php
+13
-0
13 additions, 0 deletions
src/TeamNode.php
tests/src/Kernel/TeamNodeTest.php
+15
-0
15 additions, 0 deletions
tests/src/Kernel/TeamNodeTest.php
with
28 additions
and
0 deletions
src/TeamNode.php
+
13
−
0
View file @
e4f926cb
...
...
@@ -25,6 +25,19 @@ class TeamNode extends Node {
const
BILLING_ENABLED_FIELD
=
'field_send_receipts'
;
const
BILLING_EMAIL_FIELD
=
'field_billing_email'
;
/**
* Helper to return if the team has access or not.
*/
public
function
canViewLogs
()
:
bool
{
$plan_id
=
$this
->
getPlan
()
->
getId
();
$allowed_to_view_logs
=
[
PlanInterface
::
PREMIUM_PLAN
,
PlanInterface
::
AGENCY_PLAN
,
PlanInterface
::
ENTERPRISE_PLAN
,
];
return
in_array
(
$plan_id
,
$allowed_to_view_logs
);
}
/**
* Get the env variables.
*
...
...
This diff is collapsed.
Click to expand it.
tests/src/Kernel/TeamNodeTest.php
+
15
−
0
View file @
e4f926cb
...
...
@@ -24,6 +24,21 @@ class TeamNodeTest extends KernelTestBase {
self
::
assertInstanceOf
(
TeamNode
::
class
,
$node
);
}
/**
* Test the ::canViewLogs method.
*/
public
function
testLogAccess
()
{
/** @var \Drupal\violinist_teams\TeamNode $node */
$node
=
Node
::
create
([
'type'
=>
$this
->
nodeType
->
id
(),
]);
self
::
assertFalse
(
$node
->
canViewLogs
());
$node
->
setPlan
(
PlanInterface
::
AGENCY_PLAN
);
self
::
assertTrue
(
$node
->
canViewLogs
());
$node
->
setPlan
(
PlanInterface
::
DEFAULT_PLAN
);
self
::
assertFalse
(
$node
->
canViewLogs
());
}
/**
* Test append member method.
*/
...
...
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