diff options
author | zeripath | 2023-02-20 21:28:44 +0000 |
---|---|---|
committer | GitHub | 2023-02-20 15:28:44 -0600 |
commit | d2128b44f714fcaacdc88865e62f6f9dd8216577 (patch) | |
tree | f6697bf42a61acc7f31b378882124e764281106b /modules | |
parent | 330b16642305458339d12222eea2ee9a1bbb3b64 (diff) |
Add scopes to API to create token and display them (#22989)
The API to create tokens is missing the ability to set the required
scopes for tokens, and to show them on the API and on the UI.
This PR adds this functionality.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/structs/user_app.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/structs/user_app.go b/modules/structs/user_app.go index 3a5ae34df..7f78fbd49 100644 --- a/modules/structs/user_app.go +++ b/modules/structs/user_app.go @@ -11,10 +11,11 @@ import ( // AccessToken represents an API access token. // swagger:response AccessToken type AccessToken struct { - ID int64 `json:"id"` - Name string `json:"name"` - Token string `json:"sha1"` - TokenLastEight string `json:"token_last_eight"` + ID int64 `json:"id"` + Name string `json:"name"` + Token string `json:"sha1"` + TokenLastEight string `json:"token_last_eight"` + Scopes []string `json:"scopes"` } // AccessTokenList represents a list of API access token. @@ -22,9 +23,10 @@ type AccessToken struct { type AccessTokenList []*AccessToken // CreateAccessTokenOption options when create access token -// swagger:parameters userCreateToken type CreateAccessTokenOption struct { - Name string `json:"name" binding:"Required"` + // required: true + Name string `json:"name" binding:"Required"` + Scopes []string `json:"scopes"` } // CreateOAuth2ApplicationOptions holds options to create an oauth2 application |