Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Drupal\authorization\Consumer; |
| 6 | |
| 7 | use Drupal\authorization\Plugin\ConfigurableAuthorizationPluginInterface; |
| 8 | use Drupal\user\UserInterface; |
| 9 | |
| 10 | /** |
| 11 | * Defines an interface for Authorization consumer plugins. |
| 12 | */ |
| 13 | interface ConsumerInterface extends ConfigurableAuthorizationPluginInterface { |
| 14 | |
| 15 | /** |
| 16 | * Revoke all previously applied and no longer valid grants. |
| 17 | * |
| 18 | * @param \Drupal\user\UserInterface $user |
| 19 | * The user to act upon. |
| 20 | * @param array $context |
| 21 | * Grants applied during this procedure. |
| 22 | * @param string|null $profile_id |
| 23 | * The profile ID to act upon. |
| 24 | */ |
| 25 | public function revokeGrants(UserInterface $user, array $context, string $profile_id): void; |
| 26 | |
| 27 | /** |
| 28 | * Grant one individual proposal. |
| 29 | * |
| 30 | * @param \Drupal\user\UserInterface $user |
| 31 | * The user to act upon. |
| 32 | * @param mixed $mapping |
| 33 | * What to grant. |
| 34 | * @param string|null $profile_id |
| 35 | * The profile ID to act upon. |
| 36 | */ |
| 37 | public function grantSingleAuthorization(UserInterface $user, $mapping, string $profile_id): void; |
| 38 | |
| 39 | /** |
| 40 | * Are we allowed to create things. |
| 41 | * |
| 42 | * Note that this only enables the *option* for users to choose this in the |
| 43 | * consumer configuration of the profile. |
| 44 | * |
| 45 | * @return bool |
| 46 | * Whether the consumer provides creating targets. |
| 47 | */ |
| 48 | public function consumerTargetCreationAllowed(): bool; |
| 49 | |
| 50 | /** |
| 51 | * Create authorization consumer targets. |
| 52 | * |
| 53 | * @param string $mapping |
| 54 | * What grant to create. |
| 55 | */ |
| 56 | public function createConsumerTarget(string $mapping): void; |
| 57 | |
| 58 | /** |
| 59 | * Consumer-side filtering. |
| 60 | * |
| 61 | * @param array $proposals |
| 62 | * Proposals left over after provider filtering. |
| 63 | * @param array $mapping |
| 64 | * What the proposals should be mapped against in the consumer. |
| 65 | * |
| 66 | * @return array |
| 67 | * Remaining, valid proposals. |
| 68 | */ |
| 69 | public function filterProposals(array $proposals, array $mapping): array; |
| 70 | |
| 71 | } |