Skip to content
Open
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
2 changes: 1 addition & 1 deletion pkg/auth/user/UserCommonService.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (impl UserCommonServiceImpl) CreateDefaultPoliciesForAllTypesV2(team, entit
return false, err, nil
}
_, err = impl.userAuthRepository.CreateRole(renderedRole)
if err != nil && strings.Contains("duplicate key value violates unique constraint", err.Error()) {
if err != nil && strings.Contains(err.Error(), "duplicate key value violates unique constraint") {
return false, err, nil
}
return true, nil, renderedPolicyDetails
Expand Down
6 changes: 3 additions & 3 deletions pkg/auth/user/repository/UserAuthRepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ func (impl UserAuthRepositoryImpl) CreateDefaultPoliciesForAllTypes(team, entity
return false, err, nil
}
_, err = impl.createRole(&roleData, UserId)
if err != nil && strings.Contains("duplicate key value violates unique constraint", err.Error()) {
if err != nil && strings.Contains(err.Error(), "duplicate key value violates unique constraint") {
return false, err, nil
}
err = tx.Commit()
Expand All @@ -516,7 +516,7 @@ func (impl UserAuthRepositoryImpl) CreateRolesWithAccessTypeAndEntity(team, enti
Resource: resource,
}
_, err := impl.createRole(&roleData, UserId)
if err != nil && strings.Contains("duplicate key value violates unique constraint", err.Error()) {
if err != nil && strings.Contains(err.Error(), "duplicate key value violates unique constraint") {
return false, err
}
return true, nil
Expand All @@ -543,7 +543,7 @@ func (impl UserAuthRepositoryImpl) CreateRoleForSuperAdminIfNotExists(tx *pg.Tx,
return false, err
}
_, err = impl.createRole(&roleManagerData, UserId)
if err != nil && strings.Contains("duplicate key value violates unique constraint", err.Error()) {
if err != nil && strings.Contains(err.Error(), "duplicate key value violates unique constraint") {
return false, err
}
}
Expand Down