diff options
author | Matthieu Aubry <matt@piwik.org> | 2015-09-03 04:45:42 +0300 |
---|---|---|
committer | Matthieu Aubry <matt@piwik.org> | 2015-09-03 04:45:42 +0300 |
commit | 579338351cfa7af305751becfe6f0416833458d6 (patch) | |
tree | 806d526a553ad22d39c03314183b1a1252fba10a /core | |
parent | 2ad73673c38dbc48c6ac7df4649ade4179e91578 (diff) | |
parent | d824d8beea96e916ca0fe8a696e6507cbb77955b (diff) |
Merge pull request #8703 from piwik/autosugesst_api_test
Fix AutoSuggestAPITest w/ small refactor to API.getSegmentsMetadata & Plugin\Segment
Diffstat (limited to 'core')
-rw-r--r-- | core/Plugin/Segment.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/core/Plugin/Segment.php b/core/Plugin/Segment.php index b9164898a8..8a9688fb0b 100644 --- a/core/Plugin/Segment.php +++ b/core/Plugin/Segment.php @@ -53,6 +53,14 @@ class Segment private $suggestedValuesCallback; /** + * If true, this segment will only be visible to the user if the user has view access + * to one of the requested sites (see API.getSegmentsMetadata). + * + * @var bool + */ + private $requiresAtLeastViewAccess = false; + + /** * @ignore */ final public function __construct() @@ -255,4 +263,29 @@ class Segment return $segment; } + + /** + * Returns true if this segment should only be visible to the user if the user has view access + * to one of the requested sites (see API.getSegmentsMetadata), false if it should always be + * visible to the user (even the anonymous user). + * + * @return boolean + * @ignore + */ + public function isRequiresAtLeastViewAccess() + { + return $this->requiresAtLeastViewAccess; + } + + /** + * Sets whether the segment should only be visible if the user requesting it has view access + * to one of the requested sites and if the user is not the anonymous user. + * + * @param boolean $requiresAtLeastViewAccess + * @ignore + */ + public function setRequiresAtLeastViewAccess($requiresAtLeastViewAccess) + { + $this->requiresAtLeastViewAccess = $requiresAtLeastViewAccess; + } } |