@@ -945,7 +945,7 @@ func (impl UserAuthRepositoryImpl) GetRolesForWorkflow(workflow, entityName stri
945945
946946func (impl UserAuthRepositoryImpl ) GetRoleForClusterEntity (cluster , namespace , group , kind , resource , action string ) (RoleModel , error ) {
947947 var model RoleModel
948- var queryParams []string
948+ var queryParams []interface {}
949949 query := "SELECT * FROM roles WHERE entity = ? "
950950 queryParams = append (queryParams , bean .CLUSTER_ENTITIY )
951951 var err error
@@ -986,7 +986,7 @@ func (impl UserAuthRepositoryImpl) GetRoleForClusterEntity(cluster, namespace, g
986986 } else {
987987 query += " and action IS NULL ;"
988988 }
989- _ , err = impl .dbConnection .Query (& model , query , queryParams )
989+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
990990 if err != nil {
991991 impl .Logger .Errorw ("error in getting roles for clusterEntity" , "err" , err ,
992992 bean2 .CLUSTER , cluster , "namespace" , namespace , "kind" , kind , "group" , group , "resource" , resource )
@@ -998,7 +998,7 @@ func (impl UserAuthRepositoryImpl) GetRoleForClusterEntity(cluster, namespace, g
998998func (impl UserAuthRepositoryImpl ) GetRoleForJobsEntity (entity , team , app , env , act string , workflow string ) (RoleModel , error ) {
999999 var model RoleModel
10001000 var err error
1001- var queryParams []string
1001+ var queryParams []interface {}
10021002 if len (team ) > 0 && len (act ) > 0 {
10031003 query := "SELECT role.* FROM roles role WHERE role.team = ? AND role.action=? AND role.entity=? "
10041004 queryParams = append (queryParams , team , act , entity )
@@ -1020,7 +1020,7 @@ func (impl UserAuthRepositoryImpl) GetRoleForJobsEntity(entity, team, app, env,
10201020 query += " AND role.workflow = ? ;"
10211021 queryParams = append (queryParams , workflow )
10221022 }
1023- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1023+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
10241024 } else {
10251025 return model , nil
10261026 }
@@ -1034,7 +1034,7 @@ func (impl UserAuthRepositoryImpl) GetRoleForChartGroupEntity(entity, app, act,
10341034 var model RoleModel
10351035 var err error
10361036 if len (app ) > 0 && act == "update" {
1037- var queryParams []string
1037+ var queryParams []interface {}
10381038 query := "SELECT role.* FROM roles role WHERE role.entity = ? AND role.entity_name=? AND role.action=?"
10391039 queryParams = append (queryParams , entity , app , act )
10401040 if len (accessType ) == 0 {
@@ -1043,9 +1043,9 @@ func (impl UserAuthRepositoryImpl) GetRoleForChartGroupEntity(entity, app, act,
10431043 query += " and role.access_type = ? "
10441044 queryParams = append (queryParams , accessType )
10451045 }
1046- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1046+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
10471047 } else if app == "" {
1048- var queryParams []string
1048+ var queryParams []interface {}
10491049 query := "SELECT role.* FROM roles role WHERE role.entity = ? AND role.action=?"
10501050 queryParams = append (queryParams , entity , act )
10511051 if len (accessType ) == 0 {
@@ -1054,7 +1054,7 @@ func (impl UserAuthRepositoryImpl) GetRoleForChartGroupEntity(entity, app, act,
10541054 query += " and role.access_type = ? "
10551055 queryParams = append (queryParams , accessType )
10561056 }
1057- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1057+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
10581058 }
10591059 if err != nil {
10601060 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
10661066 var model RoleModel
10671067 var err error
10681068 if len (team ) > 0 && len (app ) > 0 && len (env ) > 0 && len (act ) > 0 {
1069- var queryParams []string
1069+ var queryParams []interface {}
10701070 query := "SELECT role.* FROM roles role WHERE role.team = ? AND role.entity_name=? AND role.environment=? AND role.action=?"
10711071 queryParams = append (queryParams , team , app , env , act )
10721072 if oldValues {
@@ -1076,9 +1076,9 @@ func (impl UserAuthRepositoryImpl) GetRoleForOtherEntity(team, app, env, act, ac
10761076 queryParams = append (queryParams , accessType )
10771077 }
10781078
1079- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1079+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
10801080 } else if len (team ) > 0 && app == "" && len (env ) > 0 && len (act ) > 0 {
1081- var queryParams []string
1081+ var queryParams []interface {}
10821082 query := "SELECT role.* FROM roles role WHERE role.team=? AND coalesce(role.entity_name,'')=? AND role.environment=? AND role.action=?"
10831083 queryParams = append (queryParams , team , EMPTY_PLACEHOLDER_FOR_QUERY , env , act )
10841084 if oldValues {
@@ -1087,9 +1087,9 @@ func (impl UserAuthRepositoryImpl) GetRoleForOtherEntity(team, app, env, act, ac
10871087 query += " and role.access_type = ? "
10881088 queryParams = append (queryParams , accessType )
10891089 }
1090- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1090+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
10911091 } else if len (team ) > 0 && len (app ) > 0 && env == "" && len (act ) > 0 {
1092- var queryParams []string
1092+ var queryParams []interface {}
10931093 //this is applicable for all environment of a team
10941094 query := "SELECT role.* FROM roles role WHERE role.team = ? AND role.entity_name=? AND coalesce(role.environment,'')=? AND role.action=?"
10951095 queryParams = append (queryParams , team , app , EMPTY_PLACEHOLDER_FOR_QUERY , act )
@@ -1100,9 +1100,9 @@ func (impl UserAuthRepositoryImpl) GetRoleForOtherEntity(team, app, env, act, ac
11001100 queryParams = append (queryParams , accessType )
11011101 }
11021102
1103- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1103+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
11041104 } else if len (team ) > 0 && app == "" && env == "" && len (act ) > 0 {
1105- var queryParams []string
1105+ var queryParams []interface {}
11061106 //this is applicable for all environment of a team
11071107 query := "SELECT role.* FROM roles role WHERE role.team = ? AND coalesce(role.entity_name,'')=? AND coalesce(role.environment,'')=? AND role.action=?"
11081108 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
11131113 queryParams = append (queryParams , accessType )
11141114 }
11151115
1116- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1116+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
11171117 } else if team == "" && app == "" && env == "" && len (act ) > 0 {
1118- var queryParams []string
1118+ var queryParams []interface {}
11191119 //this is applicable for super admin, all env, all team, all app
11201120 query := "SELECT role.* FROM roles role WHERE coalesce(role.team,'') = ? AND coalesce(role.entity_name,'')=? AND coalesce(role.environment,'')=? AND role.action=?"
11211121 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
11261126 queryParams = append (queryParams , accessType )
11271127
11281128 }
1129- _ , err = impl .dbConnection .Query (& model , query , queryParams )
1129+ _ , err = impl .dbConnection .Query (& model , query , queryParams ... )
11301130 } else if team == "" && app == "" && env == "" && act == "" {
11311131 return model , nil
11321132 } else {
0 commit comments