Skip to content

ScopeGroup ​

Type
Class
Namespace
craft\oauth
Inherits
craft\oauth\ScopeGroup
Since
5.12.0

A set of OAuth scopes that users can grant to the personal access tokens they create on their Tokens screen, such as the scopes for one API.

The scopes must be defined by a registered OAuth craft\oauth\Resource.

View source

Public Properties ​

PropertyDescription
handle
label
scopes
userScopes

handle ​

Default value
null

View source

label ​

Default value
null

View source

scopes ​

Default value
null

View source

userScopes ​

Default value
null

View source

Public Methods ​

MethodDescription
__construct()
scopesFor()The scope IDs the user may grant to a token.

__construct() ​

View source

Arguments ​

  • $handle (string)
  • $label (string) – The API name, shown when more than one group is available.
  • $scopes (array<string,string>) – Scope IDs and their descriptions.
  • $userScopes (Closure, null) – Returns the scope IDs, out of those given, that a user may grant. All of them by default. Signature: function(User $user, string[] $scopes): string[]

scopesFor() ​

The scope IDs the user may grant to a token.

View source

Arguments ​

  • $user

Returns ​

string[]