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
3declare(strict_types=1);
4
5namespace Drupal\authorization;
6
7use Drupal\Core\Config\Entity\ConfigEntityInterface;
8use Drupal\authorization\Consumer\ConsumerInterface;
9use Drupal\authorization\Provider\ProviderInterface;
10use Drupal\user\UserInterface;
11
12/**
13 * Authorization Profile Interface.
14 */
15interface AuthorizationProfileInterface extends ConfigEntityInterface {
16
17  /**
18   * Get the Provider ID.
19   *
20   * @return string
21   *   Provider ID.
22   */
23  public function getProviderId(): ?string;
24
25  /**
26   * Get the Consumer ID.
27   *
28   * @return string
29   *   Consumer ID.
30   */
31  public function getConsumerId(): ?string;
32
33  /**
34   * Does the profile have valid providers?
35   *
36   * @return bool
37   *   Provider valid.
38   */
39  public function hasValidProvider(): bool;
40
41  /**
42   * Does the consumer have valid providers?
43   *
44   * @return bool
45   *   Consumer valid.
46   */
47  public function hasValidConsumer(): bool;
48
49  /**
50   * Get the active provider.
51   *
52   * @return \Drupal\authorization\Provider\ProviderInterface|null
53   *   The active provider.
54   */
55  public function getProvider(): ?ProviderInterface;
56
57  /**
58   * Get the active consumer.
59   *
60   * @return \Drupal\authorization\Consumer\ConsumerInterface|null
61   *   The active consumer.
62   */
63  public function getConsumer(): ?ConsumerInterface;
64
65  /**
66   * Get the configuration of the provider.
67   *
68   * @return array
69   *   General configuration of the provider in the profile.
70   */
71  public function getProviderConfig(): array;
72
73  /**
74   * Get the configuration of the consumer.
75   *
76   * @return array
77   *   General configuration of the consumer in the profile.
78   */
79  public function getConsumerConfig(): array;
80
81  /**
82   * Returns the currently set provider mappings.
83   *
84   * @return array
85   *   Provider mappings.
86   */
87  public function getProviderMappings(): array;
88
89  /**
90   * Get the consumer mappings.
91   *
92   * @return array
93   *   Consumer mappings.
94   */
95  public function getConsumerMappings(): array;
96
97  /**
98   * Set the configuration of the provider.
99   *
100   * Function not in use, declared by the form directly.
101   *
102   * @param array $provider_config
103   *   Provider config to set.
104   */
105  public function setProviderConfig(array $provider_config): void;
106
107  /**
108   * Set the consumer configuration.
109   *
110   * Function not in use, declared by the form directly.
111   *
112   * @param array $consumer_config
113   *   General configuration of the consumer in the profile.
114   */
115  public function setConsumerConfig(array $consumer_config): void;
116
117  /**
118   * Set the provider mappings.
119   *
120   * @param array $provider_mappings
121   *   Provider mappings.
122   */
123  public function setProviderMappings(array $provider_mappings): void;
124
125  /**
126   * Set the consumer mappings.
127   *
128   * @param array $consumer_mappings
129   *   Consumer mappings.
130   */
131  public function setConsumerMappings(array $consumer_mappings): void;
132
133  /**
134   * Return global tokens for output regarding this profile.
135   *
136   * @return array
137   *   Token strings.
138   */
139  public function getTokens(): array;
140
141  /**
142   * Check if the profile is available.
143   *
144   * @return bool
145   *   Profile valid.
146   */
147  public function checkConditions(): bool;
148
149  /**
150   * Perform grant and revokes.
151   *
152   * @param \Drupal\user\UserInterface $user
153   *   The user to work on.
154   * @param bool $user_save
155   *   Whether to directly save the user. Note that the object itself, passed
156   *   by reference, can still be save outside of this scope by later code.
157   *
158   * @return \Drupal\authorization\AuthorizationResponse
159   *   Responses.
160   */
161  public function grantsAndRevokes(UserInterface $user, $user_save = FALSE): AuthorizationResponse;
162
163}