@@ -945,7 +945,7 @@ func (impl UserAuthRepositoryImpl) GetRolesForWorkflow(workflow, entityName stri
945
945
946
946
func (impl UserAuthRepositoryImpl ) GetRoleForClusterEntity (cluster , namespace , group , kind , resource , action string ) (RoleModel , error ) {
947
947
var model RoleModel
948
- var queryParams []string
948
+ var queryParams []interface {}
949
949
query := "SELECT * FROM roles WHERE entity = ? "
950
950
queryParams = append (queryParams , bean .CLUSTER_ENTITIY )
951
951
var err error
@@ -986,7 +986,7 @@ func (impl UserAuthRepositoryImpl) GetRoleForClusterEntity(cluster, namespace, g
986
986
} else {
987
987
query += " and action IS NULL ;"
988
988
}
989
- _ , err = impl .dbConnection .Query (& model , query , queryParams )
989
+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
990
990
if err != nil {
991
991
impl .Logger .Errorw ("error in getting roles for clusterEntity" , "err" , err ,
992
992
bean2 .CLUSTER , cluster , "namespace" , namespace , "kind" , kind , "group" , group , "resource" , resource )
@@ -998,7 +998,7 @@ func (impl UserAuthRepositoryImpl) GetRoleForClusterEntity(cluster, namespace, g
998
998
func (impl UserAuthRepositoryImpl ) GetRoleForJobsEntity (entity , team , app , env , act string , workflow string ) (RoleModel , error ) {
999
999
var model RoleModel
1000
1000
var err error
1001
- var queryParams []string
1001
+ var queryParams []interface {}
1002
1002
if len (team ) > 0 && len (act ) > 0 {
1003
1003
query := "SELECT role.* FROM roles role WHERE role.team = ? AND role.action=? AND role.entity=? "
1004
1004
queryParams = append (queryParams , team , act , entity )
@@ -1020,7 +1020,7 @@ func (impl UserAuthRepositoryImpl) GetRoleForJobsEntity(entity, team, app, env,
1020
1020
query += " AND role.workflow = ? ;"
1021
1021
queryParams = append (queryParams , workflow )
1022
1022
}
1023
- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1023
+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
1024
1024
} else {
1025
1025
return model , nil
1026
1026
}
@@ -1034,7 +1034,7 @@ func (impl UserAuthRepositoryImpl) GetRoleForChartGroupEntity(entity, app, act,
1034
1034
var model RoleModel
1035
1035
var err error
1036
1036
if len (app ) > 0 && act == "update" {
1037
- var queryParams []string
1037
+ var queryParams []interface {}
1038
1038
query := "SELECT role.* FROM roles role WHERE role.entity = ? AND role.entity_name=? AND role.action=?"
1039
1039
queryParams = append (queryParams , entity , app , act )
1040
1040
if len (accessType ) == 0 {
@@ -1043,9 +1043,9 @@ func (impl UserAuthRepositoryImpl) GetRoleForChartGroupEntity(entity, app, act,
1043
1043
query += " and role.access_type = ? "
1044
1044
queryParams = append (queryParams , accessType )
1045
1045
}
1046
- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1046
+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
1047
1047
} else if app == "" {
1048
- var queryParams []string
1048
+ var queryParams []interface {}
1049
1049
query := "SELECT role.* FROM roles role WHERE role.entity = ? AND role.action=?"
1050
1050
queryParams = append (queryParams , entity , act )
1051
1051
if len (accessType ) == 0 {
@@ -1054,7 +1054,7 @@ func (impl UserAuthRepositoryImpl) GetRoleForChartGroupEntity(entity, app, act,
1054
1054
query += " and role.access_type = ? "
1055
1055
queryParams = append (queryParams , accessType )
1056
1056
}
1057
- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1057
+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
1058
1058
}
1059
1059
if err != nil {
1060
1060
impl .Logger .Errorw ("error in getting role for chart group entity" , "err" , err , "entity" , entity , "app" , app , "act" , act , "accessType" , accessType )
@@ -1066,7 +1066,7 @@ func (impl UserAuthRepositoryImpl) GetRoleForOtherEntity(team, app, env, act, ac
1066
1066
var model RoleModel
1067
1067
var err error
1068
1068
if len (team ) > 0 && len (app ) > 0 && len (env ) > 0 && len (act ) > 0 {
1069
- var queryParams []string
1069
+ var queryParams []interface {}
1070
1070
query := "SELECT role.* FROM roles role WHERE role.team = ? AND role.entity_name=? AND role.environment=? AND role.action=?"
1071
1071
queryParams = append (queryParams , team , app , env , act )
1072
1072
if oldValues {
@@ -1076,9 +1076,9 @@ func (impl UserAuthRepositoryImpl) GetRoleForOtherEntity(team, app, env, act, ac
1076
1076
queryParams = append (queryParams , accessType )
1077
1077
}
1078
1078
1079
- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1079
+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
1080
1080
} else if len (team ) > 0 && app == "" && len (env ) > 0 && len (act ) > 0 {
1081
- var queryParams []string
1081
+ var queryParams []interface {}
1082
1082
query := "SELECT role.* FROM roles role WHERE role.team=? AND coalesce(role.entity_name,'')=? AND role.environment=? AND role.action=?"
1083
1083
queryParams = append (queryParams , team , EMPTY_PLACEHOLDER_FOR_QUERY , env , act )
1084
1084
if oldValues {
@@ -1087,9 +1087,9 @@ func (impl UserAuthRepositoryImpl) GetRoleForOtherEntity(team, app, env, act, ac
1087
1087
query += " and role.access_type = ? "
1088
1088
queryParams = append (queryParams , accessType )
1089
1089
}
1090
- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1090
+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
1091
1091
} else if len (team ) > 0 && len (app ) > 0 && env == "" && len (act ) > 0 {
1092
- var queryParams []string
1092
+ var queryParams []interface {}
1093
1093
//this is applicable for all environment of a team
1094
1094
query := "SELECT role.* FROM roles role WHERE role.team = ? AND role.entity_name=? AND coalesce(role.environment,'')=? AND role.action=?"
1095
1095
queryParams = append (queryParams , team , app , EMPTY_PLACEHOLDER_FOR_QUERY , act )
@@ -1100,9 +1100,9 @@ func (impl UserAuthRepositoryImpl) GetRoleForOtherEntity(team, app, env, act, ac
1100
1100
queryParams = append (queryParams , accessType )
1101
1101
}
1102
1102
1103
- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1103
+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
1104
1104
} else if len (team ) > 0 && app == "" && env == "" && len (act ) > 0 {
1105
- var queryParams []string
1105
+ var queryParams []interface {}
1106
1106
//this is applicable for all environment of a team
1107
1107
query := "SELECT role.* FROM roles role WHERE role.team = ? AND coalesce(role.entity_name,'')=? AND coalesce(role.environment,'')=? AND role.action=?"
1108
1108
queryParams = append (queryParams , team , EMPTY_PLACEHOLDER_FOR_QUERY , EMPTY_PLACEHOLDER_FOR_QUERY , act )
@@ -1113,9 +1113,9 @@ func (impl UserAuthRepositoryImpl) GetRoleForOtherEntity(team, app, env, act, ac
1113
1113
queryParams = append (queryParams , accessType )
1114
1114
}
1115
1115
1116
- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1116
+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
1117
1117
} else if team == "" && app == "" && env == "" && len (act ) > 0 {
1118
- var queryParams []string
1118
+ var queryParams []interface {}
1119
1119
//this is applicable for super admin, all env, all team, all app
1120
1120
query := "SELECT role.* FROM roles role WHERE coalesce(role.team,'') = ? AND coalesce(role.entity_name,'')=? AND coalesce(role.environment,'')=? AND role.action=?"
1121
1121
queryParams = append (queryParams , EMPTY_PLACEHOLDER_FOR_QUERY , EMPTY_PLACEHOLDER_FOR_QUERY , EMPTY_PLACEHOLDER_FOR_QUERY , act )
@@ -1126,7 +1126,7 @@ func (impl UserAuthRepositoryImpl) GetRoleForOtherEntity(team, app, env, act, ac
1126
1126
queryParams = append (queryParams , accessType )
1127
1127
1128
1128
}
1129
- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1129
+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
1130
1130
} else if team == "" && app == "" && env == "" && act == "" {
1131
1131
return model , nil
1132
1132
} else {
0 commit comments