You are here

protected function DeveloperAppPermissionTest::revokeDefaultAuthUserPermissions in Apigee Edge 8

Revokes extra permissions that are granted to authenticated user.

These permissions are granted in apigee_edge_install(), and while they make sense from an UX point of view, they make testing permissions more difficult.

1 call to DeveloperAppPermissionTest::revokeDefaultAuthUserPermissions()
DeveloperAppPermissionTest::setUp in tests/src/Functional/DeveloperAppPermissionTest.php

File

tests/src/Functional/DeveloperAppPermissionTest.php, line 204

Class

DeveloperAppPermissionTest
Developer app entity permission test.

Namespace

Drupal\Tests\apigee_edge\Functional

Code

protected function revokeDefaultAuthUserPermissions() {
  $definition = $this->entityType;
  $user_permissions = user_role_permissions([
    RoleInterface::AUTHENTICATED_ID,
  ]);
  $authenticated_user_permissions = array_filter($user_permissions[RoleInterface::AUTHENTICATED_ID], function ($perm) use ($definition) {
    return preg_match("/own {$definition->id()}\$/", $perm);
  });
  $authenticated_user_permissions[] = "create {$definition->id()}";
  user_role_revoke_permissions(RoleInterface::AUTHENTICATED_ID, $authenticated_user_permissions);
}