Enforce image is treated as empty class
Enforces backwards compatibility with older authorization servers without requiring the client to know about the compatibility requirements. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
parent
38fbd03266
commit
426d0734d4
1 changed files with 3 additions and 1 deletions
|
@ -155,7 +155,9 @@ type RepositoryScope struct {
|
||||||
// using the scope grammar
|
// using the scope grammar
|
||||||
func (rs RepositoryScope) String() string {
|
func (rs RepositoryScope) String() string {
|
||||||
repoType := "repository"
|
repoType := "repository"
|
||||||
if rs.Class != "" {
|
// Keep existing format for image class to maintain backwards compatibility
|
||||||
|
// with authorization servers which do not support the expanded grammar.
|
||||||
|
if rs.Class != "" && rs.Class != "image" {
|
||||||
repoType = fmt.Sprintf("%s(%s)", repoType, rs.Class)
|
repoType = fmt.Sprintf("%s(%s)", repoType, rs.Class)
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%s:%s:%s", repoType, rs.Repository, strings.Join(rs.Actions, ","))
|
return fmt.Sprintf("%s:%s:%s", repoType, rs.Repository, strings.Join(rs.Actions, ","))
|
||||||
|
|
Loading…
Reference in a new issue