PeopleAccess.php in Open Social 8.4
Same filename and directory in other branches
- 8.9 modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php
- 8 modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php
- 8.2 modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php
- 8.3 modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php
- 8.5 modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php
- 8.6 modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php
- 8.7 modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php
- 8.8 modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php
- 10.3.x modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php
- 10.0.x modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php
- 10.1.x modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php
- 10.2.x modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php
Namespace
Drupal\social_user\Plugin\views\accessFile
modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.phpView source
<?php
namespace Drupal\social_user\Plugin\views\access;
use Drupal\Core\Session\AccountInterface;
use Symfony\Component\Routing\Route;
use Drupal\views\Plugin\views\access\AccessPluginBase;
/**
* People page access plugin that provides access control based on some perms.
*
* @ingroup views_access_plugins
*
* @ViewsAccess(
* id = "people_access",
* title = @Translation("People access"),
* help = @Translation("Access to the people page.")
* )
*/
class PeopleAccess extends AccessPluginBase {
/**
* {@inheritdoc}
*/
public function summaryTitle() {
return $this
->t('Unrestricted');
}
/**
* {@inheritdoc}
*/
public function access(AccountInterface $account) {
// Check if user has administer users or view user access.
$administerUsers = $account
->hasPermission('administer users');
$viewUsers = $account
->hasPermission('view users');
return $administerUsers | $viewUsers;
}
/**
* {@inheritdoc}
*/
public function alterRouteDefinition(Route $route) {
$route
->setRequirement('_custom_access', '\\Drupal\\social_user\\Controller\\SocialUserController::access');
}
}
Classes
Name | Description |
---|---|
PeopleAccess | People page access plugin that provides access control based on some perms. |