Skip to content

Commit f91859d

Browse files
committed
Merge branch 'develop' of github.com:devtron-labs/devtron into build-worker-status
2 parents 06d4e95 + e245d53 commit f91859d

File tree

10 files changed

+104
-14
lines changed

10 files changed

+104
-14
lines changed

api/bean/UserRequest.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package bean
1919
import (
2020
"encoding/json"
2121
"github.com/devtron-labs/devtron/pkg/auth/user/bean"
22+
"github.com/devtron-labs/devtron/pkg/sql"
2223
"time"
2324
)
2425

@@ -168,3 +169,40 @@ type BulkDeleteRequest struct {
168169
type UserRoleGroup struct {
169170
RoleGroup *RoleGroup `json:"roleGroup"`
170171
}
172+
173+
type GroupPermissionsAuditDto struct {
174+
RoleGroupInfo *RoleGroup `json:"roleGroupInfo,omitempty"`
175+
EntityAudit sql.AuditLog `json:"entityAudit,omitempty"`
176+
}
177+
178+
func NewGroupPermissionsAuditDto() *GroupPermissionsAuditDto {
179+
return &GroupPermissionsAuditDto{}
180+
}
181+
182+
func (pa *GroupPermissionsAuditDto) WithRoleGroupInfo(roleGroupInfo *RoleGroup) *GroupPermissionsAuditDto {
183+
pa.RoleGroupInfo = roleGroupInfo
184+
return pa
185+
}
186+
func (pa *GroupPermissionsAuditDto) WithEntityAudit(entityAudit sql.AuditLog) *GroupPermissionsAuditDto {
187+
pa.EntityAudit = entityAudit
188+
return pa
189+
}
190+
191+
type UserPermissionsAuditDto struct {
192+
UserInfo *UserInfo `json:"userInfo,omitempty"`
193+
EntityAudit sql.AuditLog `json:"entityAudit,omitempty"`
194+
}
195+
196+
func NewUserPermissionsAuditDto() *UserPermissionsAuditDto {
197+
return &UserPermissionsAuditDto{}
198+
}
199+
200+
func (pa *UserPermissionsAuditDto) WithUserInfo(userInfo *UserInfo) *UserPermissionsAuditDto {
201+
pa.UserInfo = userInfo
202+
return pa
203+
}
204+
205+
func (pa *UserPermissionsAuditDto) WithEntityAudit(entityAudit sql.AuditLog) *UserPermissionsAuditDto {
206+
pa.EntityAudit = entityAudit
207+
return pa
208+
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ require gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
288288

289289
replace (
290290
github.com/argoproj/argo-workflows/v3 v3.5.10 => github.com/devtron-labs/argo-workflows/v3 v3.5.13
291-
github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250130075053-69cdda98e3e2
292-
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250130075053-69cdda98e3e2
291+
github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250205062151-43fa5137f565
292+
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250205062151-43fa5137f565
293293
github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127
294294
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5
295295
k8s.io/api => k8s.io/api v0.29.7

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -792,10 +792,10 @@ github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzq
792792
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
793793
github.com/devtron-labs/argo-workflows/v3 v3.5.13 h1:3pINq0gXOSeTw2z/vYe+j80lRpSN5Rp/8mfQORh8SmU=
794794
github.com/devtron-labs/argo-workflows/v3 v3.5.13/go.mod h1:/vqxcovDPT4zqr4DjR5v7CF8ggpY1l3TSa2CIG3jmjA=
795-
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250130075053-69cdda98e3e2 h1:8QjRav7pCDb32Pz8HwbS1P8QQJ1QSDb3wJgAmNYkNeU=
796-
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250130075053-69cdda98e3e2/go.mod h1:5lv4Wfj5ERhhvDGXe2IeES6qxjvUVCcohaRwKnWBMNo=
797-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250130075053-69cdda98e3e2 h1:8VByFEk14t2z2DDaD/7pTgwSM7zFYEMqfthLWpt2M3w=
798-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250130075053-69cdda98e3e2/go.mod h1:1QJJLpgJSkb5Jm9xPeKAk+kXb0QgBOOOgJj0cgYhAVA=
795+
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250205062151-43fa5137f565 h1:9hEDO9lEgHW73WvsCEUZHM1IbssX1X7LR/n2it71JU0=
796+
github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250205062151-43fa5137f565/go.mod h1:5lv4Wfj5ERhhvDGXe2IeES6qxjvUVCcohaRwKnWBMNo=
797+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250205062151-43fa5137f565 h1:OZlu0xClOijctMwFa5APd9XDrQamTUqNhiRXXcN2XFM=
798+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250205062151-43fa5137f565/go.mod h1:1QJJLpgJSkb5Jm9xPeKAk+kXb0QgBOOOgJj0cgYhAVA=
799799
github.com/devtron-labs/go-bitbucket v0.9.60-beta h1:VEx1jvDgdtDPS6A1uUFoaEi0l1/oLhbr+90xOwr6sDU=
800800
github.com/devtron-labs/go-bitbucket v0.9.60-beta/go.mod h1:GnuiCesvh8xyHeMCb+twm8lBR/kQzJYSKL28ZfObp1Y=
801801
github.com/devtron-labs/protos v0.0.3-0.20240802105333-92ee9bb85d80 h1:xwbTeijNTf4/j1v+tSfwVqwLVnReas/NqEKeQHvSTys=

internal/util/adapter.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package util
2+
3+
func GetApiErrorAdapter(httpStatusCode int, code, userMessage, internalMessage string) *ApiError {
4+
return &ApiError{
5+
HttpStatusCode: httpStatusCode,
6+
Code: code,
7+
UserMessage: userMessage,
8+
InternalMessage: internalMessage,
9+
}
10+
}

pkg/auth/user/RoleGroupService.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,15 @@ func (impl RoleGroupServiceImpl) CreateRoleGroup(request *bean.RoleGroup) (*bean
8989
defer tx.Rollback()
9090

9191
if request.Id > 0 {
92-
_, err := impl.roleGroupRepository.GetRoleGroupById(request.Id)
92+
roleGroup, err := impl.roleGroupRepository.GetRoleGroupById(request.Id)
9393
if err != nil {
9494
impl.logger.Errorw("error while fetching user from db", "error", err)
9595
return nil, err
9696
}
97+
if roleGroup != nil && len(roleGroup.Name) > 0 {
98+
return nil, util.GetApiErrorAdapter(400, "400", "role group already exist with the given id", "role group already exist with the given id")
99+
}
100+
return nil, util.GetApiErrorAdapter(400, "400", "id not supported in create request", "id not supported in create request")
97101
} else {
98102
//loading policy for safety
99103
casbin2.LoadPolicy()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- Drop Table: operation_audit
2+
DROP TABLE IF EXISTS "public"."operation_audit";
3+
4+
-- Drop Sequence: id_seq_operation_audit
5+
DROP SEQUENCE IF EXISTS id_seq_operation_audit;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
BEGIN;
2+
3+
-- Create Sequence for operation_audit
4+
CREATE SEQUENCE IF NOT EXISTS id_seq_operation_audit;
5+
6+
-- Table Definition: operation_audit
7+
CREATE TABLE IF NOT EXISTS "public"."operation_audit" (
8+
"id" int NOT NULL DEFAULT nextval('id_seq_operation_audit'::regclass),
9+
"entity_id" int NOT NULL,
10+
"entity_type" VARCHAR(50) NOT NULL ,
11+
"operation_type" VARCHAR(20) NOT NULL,
12+
"entity_value_json" jsonb NOT NULL,
13+
"entity_value_schema_type" VARCHAR(20) NOT NULL,
14+
"created_on" timestamptz NOT NULL,
15+
"created_by" int4 NOT NULL,
16+
"updated_on" timestamptz NOT NULL,
17+
"updated_by" int4 NOT NULL,
18+
PRIMARY KEY ("id")
19+
);
20+
21+
COMMIT;

vendor/github.com/devtron-labs/common-lib/utils/k8s/K8sUtil.go

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,15 +336,15 @@ github.com/davecgh/go-spew/spew
336336
# github.com/deckarep/golang-set v1.8.0
337337
## explicit; go 1.17
338338
github.com/deckarep/golang-set
339-
# github.com/devtron-labs/authenticator v0.4.35-0.20240809073103-6e11da8083f8 => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250130075053-69cdda98e3e2
339+
# github.com/devtron-labs/authenticator v0.4.35-0.20240809073103-6e11da8083f8 => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250205062151-43fa5137f565
340340
## explicit; go 1.21
341341
github.com/devtron-labs/authenticator/apiToken
342342
github.com/devtron-labs/authenticator/client
343343
github.com/devtron-labs/authenticator/jwt
344344
github.com/devtron-labs/authenticator/middleware
345345
github.com/devtron-labs/authenticator/oidc
346346
github.com/devtron-labs/authenticator/password
347-
# github.com/devtron-labs/common-lib v0.18.1-0.20241001061923-eda545dc839e => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250130075053-69cdda98e3e2
347+
# github.com/devtron-labs/common-lib v0.18.1-0.20241001061923-eda545dc839e => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250205062151-43fa5137f565
348348
## explicit; go 1.21
349349
github.com/devtron-labs/common-lib/async
350350
github.com/devtron-labs/common-lib/blob-storage
@@ -2215,8 +2215,8 @@ xorm.io/xorm/log
22152215
xorm.io/xorm/names
22162216
xorm.io/xorm/schemas
22172217
xorm.io/xorm/tags
2218-
# github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250130075053-69cdda98e3e2
2219-
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250130075053-69cdda98e3e2
2218+
# github.com/devtron-labs/authenticator => github.com/devtron-labs/devtron-services/authenticator v0.0.0-20250205062151-43fa5137f565
2219+
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250205062151-43fa5137f565
22202220
# github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127
22212221
# github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5
22222222
# k8s.io/api => k8s.io/api v0.29.7

wire_gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)