Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions entry_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gitlab
import (
"context"
"fmt"
"strings"
"time"

"github.com/hashicorp/vault/sdk/logical"
Expand Down Expand Up @@ -35,7 +36,7 @@ func (e EntryRole) LogicalResponseData() map[string]any {
"role_name": e.RoleName,
"path": e.Path,
"name": e.Name,
"scopes": e.Scopes,
"scopes": strings.Join(e.Scopes, ", "),
"access_level": e.AccessLevel.String(),
"ttl": int64(e.TTL / time.Second),
"token_type": e.TokenType.String(),
Expand All @@ -54,5 +55,4 @@ func getRole(ctx context.Context, name string, s logical.Storage) (role *EntryRo
_ = entry.DecodeJSON(role)
}
return role, err

}
9 changes: 5 additions & 4 deletions path_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"cmp"
"fmt"
"os"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -325,9 +326,9 @@ func TestPathRoles(t *testing.T) {
"path": "user",
"name": "Example user personal token",
"token_type": token.TypePersonal.String(),
"scopes": []string{
"scopes": strings.Join([]string{
"invalid_scope",
},
}, ", "),
},
})
require.Error(t, err)
Expand Down Expand Up @@ -423,10 +424,10 @@ func TestPathRoles(t *testing.T) {
"token_type": token.TypePersonal.String(),
"ttl": int64((5 * 24 * time.Hour).Seconds()),
"gitlab_revokes_token": false,
"scopes": []string{
"scopes": strings.Join([]string{
token.ScopeApi.String(),
token.ScopeReadRegistry.String(),
},
}, ", "),
}

// create a role
Expand Down
Loading