Resource ​
- Type
- Class
- Namespace
- craft\oauth
- Inherits
- craft\oauth\Resource » yii\base\BaseObject
- Implements
- yii\base\Configurable
A protected API's OAuth scopes, permission policy, and canonical URL.
@since 5.12.0
Public Properties ​
| Property | Description |
|---|---|
| consentDescription | |
| defaultScopes | string[] – Scopes requested when the client omits scope. |
| id | |
| permissions | |
| resourceUrl | |
| scopeLabels | array<string,string> – Consent screen labels for access levels. |
| scopeLevels | string[] – Scopes that form access levels, ordered from narrowest to broadest. |
| scopes | array<string,string> – Allowed scope IDs mapped to consent descriptions. |
| userScopes | Closure, null – Returns the scope IDs, out of those given, that a user may be granted. |
consentDescription ​
- Default value
''
defaultScopes ​
- Type
- string[]
- Default value
[]
Scopes requested when the client omits scope.
id ​
- Default value
null
permissions ​
- Default value
[]
resourceUrl ​
- Default value
null
scopeLabels ​
- Type
array<string,string>- Default value
[]
Consent screen labels for access levels. Levels without a label show their scope ID.
scopeLevels ​
- Type
- string[]
- Default value
[]
Scopes that form access levels, ordered from narrowest to broadest. Each level includes the ones before it, and the user chooses one level on the consent screen.
scopes ​
- Type
array<string,string>- Default value
[]
Allowed scope IDs mapped to consent descriptions.
userScopes ​
Returns the scope IDs, out of those given, that a user may be granted. Signature: function(User $user, string[] $scopes): string[]
Public Methods ​
| Method | Description |
|---|---|
| __call() | Calls the named method which is not a class method. |
| __construct() | Constructor. |
| __get() | Returns the value of an object property. |
| __isset() | Checks if a property is set, i.e. defined and not null. |
| __set() | Sets value of an object property. |
| __unset() | Sets an object property to null. |
| allowsScopes() | Whether the scope IDs form a nonempty subset of this resource's allowed scopes. |
| canGetProperty() | Returns a value indicating whether a property can be read. |
| canSetProperty() | Returns a value indicating whether a property can be set. |
| className() | Returns the fully qualified name of this class. |
| getResourceUrl() | |
| grantedLevels() | The scope IDs granted by choosing an access level: the level and the narrower ones. |
| grantsCover() | Whether earlier grants cover the requested scopes. Scopes that aren't levels must all have been granted, and requested levels must overlap the levels granted by the broadest level chosen before. |
| hasMethod() | Returns a value indicating whether a method is defined. |
| hasProperty() | Returns a value indicating whether a property is defined. |
| highestLevel() | The broadest access level in the given scopes. |
| init() | Initializes the object. |
| levelChoices() | The access levels a user may choose between for the requested scopes, narrowest first. |
| narrowScopes() | Removes the requested access levels that $level doesn't grant, keeping scopes that aren't levels. |
| satisfyingLevels() | The scope IDs that satisfy an access level: the level and the broader ones. |
| scopesForUser() | The scope IDs, out of those given, that a user may be granted. |
allowsScopes() ​
Whether the scope IDs form a nonempty subset of this resource's allowed scopes.
Arguments ​
$scopes
getResourceUrl() ​
grantedLevels() ​
The scope IDs granted by choosing an access level: the level and the narrower ones.
Arguments ​
$level
Returns ​
string[]
grantsCover() ​
Whether earlier grants cover the requested scopes. Scopes that aren't levels must all have been granted, and requested levels must overlap the levels granted by the broadest level chosen before.
Arguments ​
highestLevel() ​
The broadest access level in the given scopes.
Arguments ​
$scopes(string[])
levelChoices() ​
The access levels a user may choose between for the requested scopes, narrowest first.
Arguments ​
$requested(string[])$user
Returns ​
string[]
narrowScopes() ​
Removes the requested access levels that $level doesn't grant, keeping scopes that aren't levels.
Arguments ​
$scopes(string[])$level
Returns ​
string[]
satisfyingLevels() ​
The scope IDs that satisfy an access level: the level and the broader ones.
Arguments ​
$level
Returns ​
string[]
scopesForUser() ​
The scope IDs, out of those given, that a user may be granted.
Arguments ​
$user$scopes(string[])
Returns ​
string[]