Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
martinalbert committed Oct 12, 2023
1 parent dfdca29 commit 5c396d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
7 changes: 2 additions & 5 deletions pkg/connector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,15 @@ func (dh *DockerHub) Asset(ctx context.Context, asset *v2.AssetRef) (string, io.
func (dh *DockerHub) Metadata(ctx context.Context) (*v2.ConnectorMetadata, error) {
return &v2.ConnectorMetadata{
DisplayName: "DockerHub",
Description: "Connector syncing DockerHub organization members their teams, and their roles to Baton",
Description: "Connector syncing DockerHub organizations, their members, teams, and repositories to Baton",
}, nil
}

// Validate is called to ensure that the connector is properly configured. It should exercise any API credentials
// to be sure that they are valid.
func (dh *DockerHub) Validate(ctx context.Context) (annotations.Annotations, error) {
// get the scope of used credentials
_, _, err := dh.client.ListOrganizations(ctx, &dockerhub.PaginationVars{
Size: 1,
Page: "1",
})
_, _, err := dh.client.ListOrganizations(ctx, nil)
if err != nil {
return nil, fmt.Errorf("dockerhub-connector: failed to list organizations: %w", err)
}
Expand Down
4 changes: 1 addition & 3 deletions pkg/connector/repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ func (r *repositoryResourceType) Grants(ctx context.Context, resource *v2.Resour
},
grant.WithAnnotation(
&v2.GrantExpandable{
EntitlementIds: []string{fmt.Sprintf("team:%d:%s", team.Id, teamMembership)},
Shallow: true,
ResourceTypeIds: []string{resourceTypeUser.Id},
EntitlementIds: []string{fmt.Sprintf("team:%d:%s", team.Id, teamMembership)},
},
),
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/dockerhub/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ func (c *Client) doRequest(
paginationVars *PaginationVars,
) error {
var body []byte
var err error

if data != nil {
var err error
body, err = json.Marshal(data)
if err != nil {
return err
Expand Down

0 comments on commit 5c396d1

Please sign in to comment.