Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jirwin committed Jun 10, 2024
1 parent 68e807d commit 8e82f73
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions pkg/connector/ciam.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (g *ciamResourceBuilder) Grant(ctx context.Context, principal *v2.Resource,
return nil, err
}

if errOkta.ErrorCode == "E0000090" {
if errOkta.ErrorCode == alreadyAssignedRole {
l.Warn(
"okta-connector: The role specified is already assigned to the user",
zap.String("principal_id", principal.Id.String()),
Expand Down Expand Up @@ -249,7 +249,7 @@ func (g *ciamResourceBuilder) Grant(ctx context.Context, principal *v2.Resource,
return nil, err
}

if errOkta.ErrorCode == "E0000090" {
if errOkta.ErrorCode == alreadyAssignedRole {
l.Warn(
"okta-connector: The role specified is already assigned to the group",
zap.String("principal_id", principal.Id.String()),
Expand Down Expand Up @@ -301,7 +301,7 @@ func (g *ciamResourceBuilder) Revoke(ctx context.Context, grant *v2.Grant) (anno
}

rolePos := slices.IndexFunc(roles, func(r *okta.Role) bool {
return r.Type == roleType && r.Status == "ACTIVE"
return r.Type == roleType && r.Status == userStatusActive
})
if rolePos == NF {
l.Warn(
Expand Down Expand Up @@ -332,7 +332,7 @@ func (g *ciamResourceBuilder) Revoke(ctx context.Context, grant *v2.Grant) (anno
}

rolePos := slices.IndexFunc(roles, func(r *okta.Role) bool {
return r.Type == roleType && r.Status == "ACTIVE"
return r.Type == roleType && r.Status == userStatusActive
})
if rolePos == NF {
l.Warn(
Expand Down
9 changes: 5 additions & 4 deletions pkg/connector/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
)

var errMissingRolePermissions = errors.New("okta-connectorv2: missing role permissions")
var alreadyAssignedRole = "E0000090"

// Roles that can only be assigned at the org-wide scope.
// For full list of roles see: https://developer.okta.com/docs/reference/api/roles/#role-types
Expand Down Expand Up @@ -311,7 +312,7 @@ func (g *roleResourceType) Grant(ctx context.Context, principal *v2.Resource, en
return nil, err
}

if errOkta.ErrorCode == "E0000090" {
if errOkta.ErrorCode == alreadyAssignedRole {
l.Warn(
"okta-connector: The role specified is already assigned to the user",
zap.String("principal_id", principal.Id.String()),
Expand Down Expand Up @@ -345,7 +346,7 @@ func (g *roleResourceType) Grant(ctx context.Context, principal *v2.Resource, en
return nil, err
}

if errOkta.ErrorCode == "E0000090" {
if errOkta.ErrorCode == alreadyAssignedRole {
l.Warn(
"okta-connector: The role specified is already assigned to the group",
zap.String("principal_id", principal.Id.String()),
Expand Down Expand Up @@ -397,7 +398,7 @@ func (g *roleResourceType) Revoke(ctx context.Context, grant *v2.Grant) (annotat
}

rolePos := slices.IndexFunc(roles, func(r *okta.Role) bool {
return r.Type == roleType && r.Status == "ACTIVE"
return r.Type == roleType && r.Status == userStatusActive
})
if rolePos == NF {
l.Warn(
Expand Down Expand Up @@ -428,7 +429,7 @@ func (g *roleResourceType) Revoke(ctx context.Context, grant *v2.Grant) (annotat
}

rolePos := slices.IndexFunc(roles, func(r *okta.Role) bool {
return r.Type == roleType && r.Status == "ACTIVE"
return r.Type == roleType && r.Status == userStatusActive
})
if rolePos == NF {
l.Warn(
Expand Down

0 comments on commit 8e82f73

Please sign in to comment.