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; |
| 6 | |
| 7 | use Drupal\user\UserInterface; |
| 8 | |
| 9 | /** |
| 10 | * Authorization Service interface. |
| 11 | */ |
| 12 | interface AuthorizationServiceInterface { |
| 13 | |
| 14 | /** |
| 15 | * Set the user. |
| 16 | * |
| 17 | * We pass in the user by hand so we can act on the provisional Drupal |
| 18 | * user object we have available during login and other operations. |
| 19 | * |
| 20 | * @param \Drupal\user\UserInterface $user |
| 21 | * The user to act upon. |
| 22 | */ |
| 23 | public function setUser(UserInterface $user): void; |
| 24 | |
| 25 | /** |
| 26 | * Get the user. |
| 27 | * |
| 28 | * @return \Drupal\user\UserInterface |
| 29 | * The user to act upon. |
| 30 | */ |
| 31 | public function getUser(): UserInterface; |
| 32 | |
| 33 | /** |
| 34 | * Process a specific profile. |
| 35 | * |
| 36 | * Saves the user account. |
| 37 | * |
| 38 | * @param string|int $profile_id |
| 39 | * Authorization profile to act upon. |
| 40 | */ |
| 41 | public function setIndividualProfile($profile_id): void; |
| 42 | |
| 43 | /** |
| 44 | * Fetch and process all available profiles. |
| 45 | * |
| 46 | * Saves the user account. |
| 47 | */ |
| 48 | public function setAllProfiles(): void; |
| 49 | |
| 50 | /** |
| 51 | * Query a specific profile. |
| 52 | * |
| 53 | * This does *not* save the user account. We need this to simulate granting |
| 54 | * to know that in some modes we want to abort any further actions |
| 55 | * (e.g. no valid proposals in exclusive mode and deny access set). |
| 56 | * |
| 57 | * @param string $profile_id |
| 58 | * Authorization profile to act upon. |
| 59 | */ |
| 60 | public function queryIndividualProfile(string $profile_id): void; |
| 61 | |
| 62 | /** |
| 63 | * Fetch and query all available profiles. |
| 64 | * |
| 65 | * This does *not* save the user account. |
| 66 | * |
| 67 | * @see queryIndividualProfile() |
| 68 | */ |
| 69 | public function queryAllProfiles(): void; |
| 70 | |
| 71 | /** |
| 72 | * Returns list of all authorizations, which were processed. |
| 73 | * |
| 74 | * @return AuthorizationResponse[] |
| 75 | * Authorizations by human-readable label. |
| 76 | */ |
| 77 | public function getProcessedAuthorizations(): array; |
| 78 | |
| 79 | /** |
| 80 | * Clear processed authorizations. |
| 81 | * |
| 82 | * If the service is called multiple times (e.g. for testing with query(), |
| 83 | * instead of set()) this allows one to clear the list of processed |
| 84 | * authorizations. |
| 85 | */ |
| 86 | public function clearAuthorizations(): void; |
| 87 | |
| 88 | } |